If you really, really want to understand mortgage-backed securities, I link to a couple of posts on the subject, but first provided a primer on stripping and securitizing loans. The links I had were to a series on Calculated Risk, which now has the third installment: "MBS For UberNerds III: Credit Risk, Credit Enhancement, and Ratings."
Be warned that this is dense going. My favorite line:
Some individual loans are credit enhanced by, basically, being tranched themselves: that’s what an 80/20 deal is. (Which is why CE on a HELOC pool is a whole different bowl of chocolates from a first-lien mortgage pool.) Whole pools can also be enhanced with MI: that’s a pool-level policy.