An annuity is a contract with an insurance company where you lend the company your money for a period of time and they promise to give it back to you with interest when you ask for it or in payments over your lifetime at your option. Surrender penalties apply if you ask for it too soon.
Income taxes on annuity investment contracts (both fixed and variable) are deferred until withdrawals are made. At the time of distribution, the insurance company should report on your Form 1099-R the basis attributable to the distribution you took that year. Your basis in that year's distribution is the difference between the gross amount of the distribution (box 1) and the taxable amount (box 2a).
The general rule for all deferred annuities is that you owe income tax when you take the money out, but the portion which represents your after-tax "investment in the contract" (i.e. your cost basis) is excluded from taxation. This applies whether you take the distribution as a partial surrender, a full lumpsum payment, or as a periodic annuity payment over your lifetime. However, there are differences in when you can deduct your cost basis depending on (a) when the annuity was issued; and (b) whether you take the withdrawal as a distribution(either lumpsum or partial) or as a periodic annuity payment.
The general rule for distributions from annuities bought before 8/14/1982 is that you are not taxed on the income until you have withdrawn all of your investment first. You get back your cost basis first. This is "FIFO" (first in, first out) tax treatment. This more favorable tax treatment continues to apply on a "grandfathered" basis if you exchange your pre-8/14/1982 annuity for another one under IRC Section 1035 exchange rules.
The general rule for distributions from annuities bought after 8/14/1982 is that you are taxed on all the income first and you get back your cost basis last. This is "LIFO" (last in, first out) tax treatment. The first dollars that come out are taxed until you have recognized all the accumulated earnings inside the annuity. All further withdrawals are tax-free return of cost basis. Notice how the IRS gets their taxable income recognition first!
For full cash surrenders of an annuity contract, the taxable portion is the excess of the cash received over your cost basis, the investment in the contract. If there is a loss, the loss can be deducted on Form 1040 Schedule A as a miscellaneous itemized deduction (subject to a 2% of adjusted gross income floor.) The advantage of this tax treatment is that the annual $3,000 capital loss limitation is not applied.
For periodic annuity payments from non-qualified annuity contracts, your cost basis is allocated prorata over the anticipated total annuity payments using IRS-approved actuarial life expectancy tables. Non-qualified means it is not part of a qualified employee retirement plan. An exclusion ratio (representing the percentage of the total expected return that is your cost basis) is calculated and applied to each payment.
However, you should not just accept at face value whatever your Form 1099-R reports. You want to verify it against your own investment records because the cost basis accounting for investment annuities can get mangled when annuity rollovers occur. In particular this may occur when a Section 1035 exchange (tax-free rollover) is between different insurance companies. If your cost basis in the annuity is not properly transferred between the insurers, when you take a distribution the Form 1099-R will report NO basis, and the distribution amount will be fully taxable to you. This would result in you paying taxes TWICE on the same income--once when you saved the after-tax income to buy the annuity in the first place and once again when you are taxed on the full withdrawal. You only owe income tax on the portion of the distribution attributable to investment earnings built up inside the annuity.
It is highly recommended that you call the new insurance company after a Section 1035 exchange has taken place and ask the customer service rep what their records show as the "investment in the contract", i.e. the cost basis. If you know you had basis in your previous annuity and it was not properly transferred, the time to take corrective action is now, not years down the road when you start taking distributions.
Despite their complexity, annuities are popular because they can be used to shift to an insurance company the risk of out-living your income.
If your annuity was issued before October 21, 1979, your heirs will be very happy. Your annuity will get a step-up in basis to the market value at the time of your estate and no income tax will be owed on the past earnings. This was such a great deal for the taxpayer that Congress took away the goodies, but your annuity was "grandfathered" to retain the special tax benefit. If you exchange your annuity, even in a tax-deferred Section 1035 exchange, the grandfathered benefit will be lost.
Here is the Internal Revenue Bulletin Revenue Ruling 2005-30 affirming the stepup treatment for pre-10/21/1979 annuities for readers interested in the details.