Yes - you may deduct passive losses from rental activities, but such deduction is limited
If you or your spouse actively participated in a passive rental real estate activity, you can deduct up to $25,000 of loss from the activity from your nonpassive income. This special allowance is an exception to the general rule disallowing losses in excess of income from passive activities.
If you are married, filing a separate return, and lived apart from your spouse for the entire tax year, your special allowance cannot be more than $12,500. If you lived with your spouse at any time during the year and are filing a separate return, you cannot use the special allowance to reduce your nonpassive income or tax on nonpassive income.
The maximum amount of the special allowance is reduced if your modified adjusted gross income is more than $100,000 ($50,000 if married filing separately).
If due to limitations - you may not deduct rental losses - losses will be carried over to the next year and - if unused - will be deducted at the time you sell the rental property.
You may find some additional information in IRS publications:
Use Schedule D (Form 1040) to report sales, exchanges, and other dispositions of capital assets. Before completing Schedule D, for a disposition of an interest in, or property used in, a passive activity, complete Form 8582, Passive Activity Loss Limitations. - http://www.irs.gov/pub/irs-pdf/f8582.pdf - here you will report unallowed losses.
see instructions - http://www.irs.gov/pub/irs-pdf/i8582.pdf
and IRS publication 925 - http://www.irs.gov/pub/irs-pdf/p925.pdf
Form 8582, Passive Activity Loss Limitations is the form that computes the loss allowed or carried over each year, adds the carry over loss to the next year and then allows the balance of the carry forward loss in the year of the sale.
The allowable loss from Form 8582 is what is reported on the Schedule E : Line 22 is for Income or (loss) from rental real estate... and Line 23 is for Deductible rental real estate loss. and also says: Caution. Your rental real estate loss on line 22 may be limited. See page E-5 to find out if you must file Form 8582.
So in a given year the actual income and deductions are totaled for Schedule E Line 22 but the amount that is deducted is figured on Form 8582 along with the amount to carry to the next year. In the next year, again the actual income and deductions are totaled for Schedule E Line 22 but the amount that is deducted for that year is figured on Form 8582 along with the amount to carry to the next year (which includes the prior year carryover amount.
Finally in the year of the sale (if you completely dispose of your entire interest in a passive activity or a former passive activity) you report net income or loss and prior year unallowed losses from the activity. All the net income and losses are reported on the forms and schedules normally used (Sch E and Form 8582). See Reporting an Entire Disposition on Schedule D or Form 4797
I hope this explains how the carryforward passive losses are deducted when the rental property is disposed.