The bailout was the necessary result of the players in financial markets becoming grossly over-leveraged under the free market self regulated rah-rah of the Bush years & Admin, and because of the interlocking nature of their operations.
Everybody was playing everybody else on the basis of imaginary value in the housing market, and when that fell down, there was insufficient liquidity to cover all the bets, even though it was a zero sum game anyway.
The players depended strongly on the Repo market for liquidity- borrowing short term against the value of paper assets, and when investors saw the risk as too large, that source of cash disappeared.
What the bailout accomplished was providing enough liquidity for the bets to be paid and the balance sheets to balance. Yes, enormous sums were moved around in circles, which was what needed to happen to preserve the system. The FRB went even further, paying cash for long term securities, as well, to enable those payoffs.
And now what? How do we protect ourselves from future occurrences of the same thing? According to Repubs, nothing at all, because the bad boys of Wall St have seen the light, come to Jesus, promised to be good... Honest!
And if you believe that, then you're ready for the idea that cutting spending to force layoffs of govt workers & contractors will create jobs, too... along with all of the other Repub blather that can easily destroy this country if implemented.