For synthetic CDOs, the cash flow comes from counterparties who bet against the mortgages.
CDO-squareds and synthetic CDOs are not the same thing. A CDO-squared is a CDO made up of the equity tranches of CDOs. (In the movie version of The Big Short, this is explained by Anthony Bourdain with his fish soup analogy.) In these securities the money to support the securities' payments comes from the payout from the underlying CDOs, which in turn comes from their underlying assets (such as mortgages). As long as the base assets don't default enough to cause the equity tranches of the CDOs they make up to default, everyone is happy. The problem with CDO-squareds is that because the equity tranches are the first to experience losses, a small uptick in mortgage default rates causes a lot of different CDOs to experience losses in their equity tranches. Therefore, the incidence of default in the equity tranches of CDOs is a lot more correlated than the models of CDO-squared securities assumed, which means that CDO-squareds were a lot more risky than their ratings suggested. (This correlation could be compounded by the fact that different CDOs might own slices of the same mortgages, making them even more correlated, further increasing risk.)
A synthetic CDO is made up of derivatives, generally swaps. These derivatives are essentially agreements between two parties to make payments to one another based on the performance of some designated underlying security. Often these were credit default swaps (CDS), where the agreement is that one party would make small payments, sort of like insurance premiums, if the security didn't default, and the other would make a large payment if the security did default.
The Wikipedia article on synthetic CDOs sums it up nicely:
The seller of the synthetic CDO gets premiums for the component CDS and is taking the "long" position, meaning they are betting the referenced securities (such as mortgage bonds or regular CDOs) will perform. The buyers of the component CDS are paying premiums and taking the "short" position, meaning they are betting the referenced securities will default. The buyer receives a large payout if the referenced securities default, which is paid to them by the seller. The buyers of the synthetic CDO are taking a long position in the component CDS pool, as if the referenced securities default the seller of the synthetic CDO must pay out to the buyers of the component CDS rather than the buyers of the synthetic CDO.
The term synthetic CDO arises because the cash flows from the premiums (via the component CDS in the portfolio) are analogous to the cash flows arising from mortgage or other obligations that are aggregated and paid to regular CDO buyers. In other words, taking the long position on a synthetic CDO (i.e., receiving regular premium payments) is like taking the long position on a normal CDO (i.e., receiving regular interest payments on mortgage bonds or credit card bonds contained within the CDO).
In the event of default, those in the long position on either CDO or synthetic CDO suffer large losses. With the synthetic CDO, the long investor pays the short investor, versus the normal CDO in which the interest payments decline or stop flowing to the long investor.
So, that's the answer to your question: the money comes from counterparties who took the other side of a bet on the performance of the mortgages. Therefore, in addition to having more default risk from the mortgages than buyers understood at the time, synthetic CDOs carried additional risk from the long party's obligations to the short party in the event of a default. Very few people involved in the synthetic CDO trade in the early 2000s (including, I would argue, the hedge funds that took the short positions) understood this.
(Side note: In TBS Michael Lewis goes, IMO, way too easy on the hedge fund guys who bet against the CDOs. They were right about the way the market was going, but wrong about their counterparties' ability to pay, so they should have been wiped out. Ultimately, much of the government bailout funds wound up in the pockets of these hedge funds, a point that Lewis greatly deemphasizes in his coverage.)
All of this, by the way, is why I argue that there never was a "mortgage crisis" or "housing crisis". It was entirely a "structured finance crisis". A bunch of institutions invested money they couldn't afford to lose in extremely risky assets. The losses on those assets were only tangentially related housing or mortgages.