A grantor trust is a non-exclusive type of trust where the grantor retains or gives to his spouse one or more of the powers or interests in 26 U.S.C. §§ 673–678. These are basically "strings" of control over the property like having discretion over distributing income or having AART powers.
Trusts required to distribute all income (all simple trusts and some complex trusts) have a deduction in lieu of a personal exemption of $300; other trusts get a $100 deduction. Estates get $600.
The tax differences between simple and complex trusts are inconsequential. So while a trust's status must be declared on the return, they can always just be analyzed as a complex trust.
Fiduciary account income is largely determined by state law, but it includes both tax-exempt and normal income (including interest) and excludes capital gains and losses. 26 U.S.C. § 643(b).
Capital gains and losses are just allocated as an increase in principal, not as actual income. UPIA § 404.
Some other expenses may be treated like this too, and some are half included. UPIA § 502.
After determining DNI, it must be allocated among the distributions.
First, indirect expenses of the trust must be segregated pro rata between taxable income and tax-exempt income. The differences after subtracting direct expenses and these portions of indirect expenses from classes' gross incomes are the net amount of DNI for the classes (which should add back up to the total DNI). You really only care about the percentages here though.
Second, DNI must be allocated among the distributions according to a tier list:
A trust's taxable income is its gross income from 26 U.S.C. § 61 (including capital gains and excluding tax-exempt interest) minus its expenses and charitable deductions (allocable to non-tax-exempt income (26 U.S.C. § 265.)), distributions deduction, and the personal exemption substitute deduction.