How do companies with shareholders close up shop? How can a company with shareholders stop operations without being acquired or going bankrupt?  

How is a company with shareholders that is closing up shop able to give shareholders money back for their shares if the shareholders invested more money than the value of the company's assets?

If a company with shareholders has closed up shop in the past without being acquired or going bankrupt, what are some well-known examples?
We need to distinguish between private corporations, and public. Private corporations are largely free in what they do, public corporations listed on stock exchanges have to follow various procedures.

For any corporation, there’s no guarantee that you make a profit, so what price you bought it at makes no difference.

If a company wound up its affairs, it would make a final cash distribution to shareholders, and that would be it. The cash would either be a dividend or a return of capital, depending upon the equity levels of the company.

The problem is that do this, the company would have to sell all assets simultaneously. That is normally difficult to do, and so it is much more usual for the entire firm to bought out (after selling some assets).

Furthermore, having a listing on the stock exchange is itself valuable. It would be far more common for a company to pursue a “reverse takeover”: the listed company appears to take over a private firm, but the private firm actually buys out the existing shareholders. This way, the private firm saves the expenses of seeking a listing on the stock exchange. Just shutting the firm down would probably be viewed as a suboptimal course of action, and might expose the directors to lawsuits.

What is more likely is that companies largely fail, and end up having to shut down most of their operations. After awhile, they will not meet listing requirements to remain on the stock exchange, and the shares are delisted. The shares still exist, but it is very hard to find buyers.

If you want to find examples, you could just do a web search looking for the terms “delisted companies” and the name of a stock exchange that you are interested in. The following link is an example: 
TSX Venture Exchange listing changes