Ponzi schemes (or pyramid schemes) are based on paying earlier investors from the money invested by the later ones. For Ponzi scheme, the idea is generally to distribute some relateviely high consistent dividend/payout based on the inflow of money from new investors. As long as new investors are coming, the scheme can be sustained for quite some time (see the Madoff's example that spanned over decades). In the mean time the scheme operator can take (some of) the investment money to himself (legally as fees and salary, illegally as embezzling). The scheme operator doesn't actually have to put in any money other than some organizational expenses.
However, at some point the new investors' money won't be enough to pay all the existing investors (inevitably, sooner or later, since the dividend payout grows with each new investor and there are no infinite exponential amount of new investors to cover for it). That's when the $#!+ hits the fan and sons of the schemers start ending up hanging from the ceiling.
Pyramid scheme is built on similar idea, but the dividend payout varies based on the level of the investor (i.e.: the investor gets paid based on how many new ones he brought in, and how many new ones rooted from them). Thus the incentive to bring new investors is directly shifted to the investors themselves. The schemers here are at the top and get the most payouts from all the rest of the participants. They themselves usually put no or very little investment. However, the end result is the same: couldn't possibly be enough investors to sustain this model forever, and it will inevitably fail at some point.
When such a scheme fails - the paying fund ends up being bankrupt, either due to cashflow problems (not enough money in to pay money out) or because all the money dries out (usually - both).
How to detect - if the reports are not falsified (which in most cases they are) you'll see clearly that there's no actual investment income in the cash-flow. But, the reports are usually falsified to conceal this exact fact. So, that's where the independent auditors and regulatory oversight come in handy.
Generally, if an investment fund doesn't have a reputable independent auditor - stay away.