If you have excellent credit, friends or family may ask you to cosign on loans. Cosigning a loan commits you to paying it off if the borrower defaults. In many cases, the lender may require a co-signer if the primary borrower doesn't have a strong enough credit score, or has inadequate income. If the person you co-signed for dies, you may still owe the loan balance.
TL;DR (Too Long; Didn't Read)
A co-signer may be ordered to pay the loan of a deceased individual in the event that the deceased individual's estate doesn't cover the balance owed.
When someone dies, the person's estate is obligated to pay off his debts. If the estate doesn't have enough money, then you, as the cosigner, are on the hook for whatever debt remains. Even if the estate has the money, the lender may be able to ask you to pay instead. The law in most states doesn't require lenders to collect from the borrower or his estate. If it looks easier to get the money from you, it's perfectly acceptable to come after you first.
If you cosign a federal student loan, and the student dies, those loans have a debt discharge that wipes them out. Some private student loans may offer a discharge, but many don't. Cosigning a house or auto loan is a special case because the asset is collateral for the loan. You can often settle the debt by letting the lender take the house or car back. That's going to hurt your credit score, however, as it goes down in your history as a loan you didn't pay off.
Sizing Things Up
Even if the main borrower doesn't die, he or she can still default on her loan, leaving you stuck paying it off. Before you agree to cosign, go over the borrower's finances. It may be the bank is right and the borrower really can't pay off the loan, in which case cosigning might be a big mistake. Look at your own finances and how badly it'll hurt if the worst happens and you have to pay the loan back.
If you decide to go ahead and cosign, do your best to protect yourself. Get copies of the loan agreement in case there's a dispute over the terms. Ask the lender to notify you if a payment comes in late or the interest rate goes up. Try negotiating with the lender so that you don't have to pay fees or penalties. Get everything you agree to in writing. Most of all, be sure only to agree to cosign for people you trust.