system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5:In simple terms, how does one value a company? From a large company like Apple or a little startup that has yet to go public?
gpt
You own a lemonade stand. To do so you have to own some resources (lemons, secret recipe, contract to buy lemons at X dollars per pound for the next several months, a building, juicers, cash on hand for transactions, etc.). Your business gets X dollars in revenue on average each year, has Y expenses, and has Z debt. This all gets added up into your company's "book value," as it shows up on things like your balance sheet, statement of cash flows, and income statement, which are commonly referred to as the company's books.

We know from comparing your stand to other lemonade stands and other similar business, like the snow ball stand down the road, that your particular stand is either performing well, about as could be expected, or worse than normal. 

We then look at things like how we think the economy, weather, and lemon harvest are doing and whether people will have enough money to buy lemonade, will want lemonade because of the heat, or whether lemons will be more or less expensive in the future. 

Based on all this information, we can get a good idea in terms of how well we think both your particular lemonade stand and the summer refreshment industry in general will do in the future. Based on this, we give your company a value, and this is generally what you hear reported in news stories. Put simply, this is where we say that a man looking to buy your lemonade stand should pay you X for it.

Companies are often bought or sold for more or less than the generally agreed upon value for various reasons. That value also may or may not be then reflected accurately in the company's stock price if it is publicly traded, as the stock price can be affected by a lot of things that have little to do with the lemonade stand's actual profitability, such as the 9/11 attacks bringing down prices on the stockmarket overall (Which is why President Bush advised people to go shopping after. He wanted to ensure that people regained confidence in the market and keep both stock prices and the economy chugging along).

Edit: Another reason is that a given company may be uniquely valuable to another in a way that others don't immediately realize (today's purchase of LinkedIn by Microsoft being a timely example, as Microsoft paid far more for the company than the cumulative market value of all its stock).