Alex Tabarrok writes a pretty good explanation of how CDOs restructure risk.
As he mentions in his post, models which underestimate the expected default rate will blow up the structure. I should also mention that underrepresenting the correlation among assets will likewise result in a structure that's prone to blow up, and that beyond a certain point, all correlations will move toward 1, meaning that the failure of enough mortgages in a pool will make it almost certain that the other mortgages will fail and that your model will have underestimated this fact.
In the recent meltdown, both of these things happened: the chances that the underlying mortgages would independently fail increased and the correlation among all of the mortgages increased. Moreover, there were a number of CDOs out there that appear to have been filled with lemons, where the odds of the underlying failing were known to be higher by the seller, but not the buyer.