Getting cash out is no different for sharks on Shark Tank than any other investors in private equity: they can make money back from dividends that are yielded by profits; or by selling on the shares to someone else; or by asset-stripping the companies - i.e. selling off their assets, and closing down the trading activities of the company.
As with most other equity investors, they own shares in a mix of companies. So to make money overall, they don't need to make money on every single company. They can accept that some will do badly (often losing them their whole investment), and some will do well, but overall, they expect to make a profit on the portfolio.
Indeed, in general, for investing in small companies with private equity, the expectation might normally be that most investments will yield the investor a 100% loss, but the few that do make a profit, make such a big profit that the overall bottom line is positive.
However, the sharks do have the huge advantage that every one of their companies has received significant free tv advertising, and has had the public endorsement of a supposed "smart" investor, which tilts the odds in their favour.