A public company is one whose stock can be purchased by the general public, for instance through a stock exchange like NASDAQ, which greatly expands the pool of possible investors as compared to a private company. In return for this opportunity, the government requires that public companies publish statements of their financial status every quarter, and those statements have to be confirmed or audited by an independent third party. This is because financial bozos like you and me can buy the stock and the only information we have about the company is what they tell us or we read in the paper. The auditing requirement is an attempt to keep the owners honest about how the company is doing. Mostly the system works but there have been notable failures due to fraud by the corporate management or incompetence on the part of the auditors.
The price of the stock at any time is determined through a public auction in which a buyer purchases the stock at a price she is will to pay from a seller at a price at which he is willing to sell. Billions of shares of public company stock are traded in this way every day around the world. Like in a privately-held company, investors are hoping that the company will return some of the profit or earnings in the form of dividends, or that the value of the shares will increase and the stock can be sold to capture the gain. It's important to understand that the company doesn't benefit from the daily trading of the stock - those are transactions between the buyers and sellers. The company makes money from the sales of newly issued stock only, at an IPO for example (or stock that it has bought on the open market and then resells).
One of my friends once asked me "Since the company doesn't benefit from the daily trading, why should they care if the stock price tanks once they have issued the shares?". There are several answers to this. First, the managers and employees of the company may own stock and when they go to sell it they want to see a nice, high price. Secondly, if the company needs to go back into the stock market to raise additional money, they want to sell as few shares as possible to raise the money they need. Remember those shares represent ownership of the company. Which brings us to the last point. Since those shares represent ownership and (usually) voting rights, if the shares are cheap someone else could buy them up and once they own most of the company can throw out the jerk management who let the stock price slide. So management has a lot of incentives to keep the stock price high.
Like in privately-held companies, the investors in public companies aren't liable for debts of the company. So if the company goes bankrupt they can lose their entire investment, but no more.