It's kind of like a swaps casino: Hedge funds, banks and insurance companies pay premiums to buy protection against defaults on bonds, CDOs or other assets. Unlike with traditional insurance, buyers don't need to own the assets to buy protection. Here are the steps:
A company issues a bond or a trust issues an asset-backed security (often containing stuff like subprime loans)
A hedge fund or bank buys protection from another bank against the risk that the company will default on the bond or ABS. The bank promises "payment of the face value of the debt" to the protection buyer in the event of default.
The bank can buy protection in 2 ways: from another bank or from investors by creating a synthetic collateralized debt obligation, or CDO, which consists of bundles of CDSs.
The same bank purchases protection from a bond insurer against the risk of the CDOs failing, in the form of yet another CDS (In late 2007, the bond insurance companies, also known as monoline insurers, stopped writing protection on CDOs).
The protection buyers make regular payments to the protection sellers for each CDS.
In the event of a bond default, the seller of protection pays full face value of the bond to the protection buyer. If the CDO's collateral is insufficient to make good on the default, the bond insurer is obligated to step in.
If the bond insurer lacks the cash to make good on the default, there may be a chain of defaults from the bond insurer to the CDO to the bank.