If a company has already 'exited' with an IPO and sold its shares, what is the incentive to keep making money?
A company doesn't offer up 100% of its shares to the market. There's a float amount of varying significance, maybe 30% of the shares are put up for public offer. Generally some amount of current shareholders will pledge some or all of their shares for offer to the public. This may be how the venture capital, private equity or other current investors cash out their initial investment. The company may issue new shares in order to raise money for some initiative. It may be a combination of existing shares and new.
Additionally, a company may hold some "treasury shares" on its balance sheet. In this instance fluctuations in the share price directly affect the health of the balance sheet.
As far as incentive goes, stock options to management and C-Suite employees keep everyone interested in an increasing stock price.
Because people bought their shares under the premise that they would make more money and if the company completely lied about that they will be subject to several civil and criminal violations.
If people didn't believe the company was going to make more money, they would have valued their shares lower during the IPO by not forming much of a market at all.