This book review in The New Yorker magazine provides the first understandable description of credit default swaps and how they worked (or didn't work) that I have seen to date. I'll run down the outline of it here, but please read the piece for yourself...
1. Currency swaps. In a currency swap two businesses exchange a portion of their business without trading the actual business itself. The first such swap took place in 1981 when IBM traded surplus Swiss and German currency for dollars held by the World Bank. The two companies, according to the article, "exchanged their obligations to bondholders and their bond earnings without actually exchanging the bonds." The deal "was worth two hundred and ten million dollars over ten years and ushered in a whole new field of finance." In fact, in a little over a decade the total volume of these interest-rate and currency derivatives was more than twelve trillion dollars...ie greater than the entire US economy!
2. Credit default swaps. In 1994 some employees of J.P. Morgan developed the concept of swapping risk. If you could pay someone else to take on the risk of loans you write, you wouldn't need so much capital on hand to cover your risks.
3. Securitization. In old-school banking each loan was evaluated on its own. "What securitization did was bundle together a package of these loans, and then rely on safety in numbers and the law of averages: even if some loans did default, the others wouldn’t."
4. Tranching. ('Tranche' means 'slice' in French.) Someone realized you could slice up the underlying securities into different levels of risk and offer them at different rates, so that the riskier tranches would provide higher yields.
5. Collateralized Debt Obligations (CDO's). Now let's put it all together. By creating mortgage-based securities in which a pool of mortgages is securitized and tranched with the riskier mortgages (the "sub-prime" mortgages) providing higher yields while the risk of default has been swapped out, you can create banking's equivalent of the perpetual motion machine...risk and yield have been magically divorced from one another.
The hidden assumption here is that the value of the real estate which supports this pool of mortgages will always increase, or at least hold steady. Thus the underlying value of the loans will never decline. Because if (or when) it does, the entire CDO system collapses.
And there you have it...