It's bad news when someone who owes you money fails to pay the debt. You may be able to compensate for your loss by taking a tax deduction, but some bad debts don't even give you that benefit. Even if a debt is completely worthless -- there's no hope of collecting -- you may not be able to write it off.
Most individuals use cash basis rather than accrual when figuring their taxable income. With accrual, you record income as soon as its earned; with cash basis, you only record it when you have the check in hand. If you record income on an accrual basis -- wages or alimony, for instance -- and it doesn't come in, you can deduct the unpaid money from your income. With cash basis that's not an option, as you never recorded the income -- and therefore, if you don't get paid, there's no compensation.
If you're a cash-basis taxpayer and you loan someone money, that's another story. Bad loans are a legitimate tax deduction that you write off as a short-term capital loss on Schedule D. It has to be clear that the money was a loan, not a gift, and that there's zero chance of collecting. You have to make a reasonable effort to collect what you're owed, or show that it would be useless to try -- for example, if your debtor died insolvent.
If you run your own business and use accrual methods, you deduct business bad debts on Schedule C, the self-employment form. Suppose you do a $400 job for one of your clients and record the income in your accounts. If it becomes obvious the client can't or won't pay, you deduct the $400 to reflect the ugly truth. Unlike personal debts, which have to be completely uncollectable, you can deduct partial losses on business debts: if the $400 client pays $150, you can write off $250.
If you want to write off a bad debt, you must do so in the same year that the debt became obviously worthless. This doesn't have to be when the debt is due: if your debtor goes bankrupt before that point, the bankruptcy is evidence that you can't collect. If your debt becomes worthless this year, but you don't discover this until after you file your return, you have to file a 1040X amended return for that tax year if you want to claim the write-off.