It's been said before, but to repeat succinctly, a company's current share price is no more or less than what "the market" thinks that share is worth, as measured by the price at which the shares are being bought and sold. As such, a lot of things can affect that price, some of them material, others ethereal.
A common reason to own stock is to share the profits of the company; by owning 1 share out of 1 million shares outstanding, you are entitled to 1/1000000 of that company's quarterly profits (if any). These are paid out as dividends. Two key measurements are based on these dividend payments; the first is "earnings per share", which is the company's stated quarterly profits, divided by outstanding shares, with the second being the "price-earnings ratio" which is the current price of the stock divided by its EPS. Your expected "yield" on this stock is more or less the inverse of this number; if a company has a P/E ratio of 20, then all things being equal, if you invest $100 in this stock you can expect a return of $5, or 5% (1/20).
As such, changes in the expected earnings per share can cause the share price to rise or fall to maintain a P/E ratio that the pool of buyers are willing to tolerate. News that a company might miss its profit expectations, due to a decrease in consumer demand, an increase in raw materials costs, labor, financing, or any of a multitude of things that industry analysts watch, can cause the stock price to drop sharply as people look for better investments with higher yields. However, a large P/E ratio is not necessarily a bad thing, especially for a large stable company. That stability means the company is better able to weather economic problems, and thus it is a lower risk.
Now, not all companies issue dividends. Apple is probably the most well-known example. The company simply retains all its earnings to reinvest in itself. This is typically the strategy of a smaller start-up; whether they're making good money or not, they typically want to keep what they make so they can keep growing, and the shareholders are usually fine with that. Why? Well, because there's more than one way to value a company, and more than one way to look at a stock. Owning one share of a stock can be seen quite literally as owning a share of that company. The share can then be valued as a fraction of the company's total assets.
Sounds simple, but it isn't, because not every asset the company owns has a line in the financial statements. A company's brand name, for instance, has no tangible value, and yet it is probably the most valuable single thing Apple owns. Similarly, intellectual property doesn't have a "book value" on a company's balance sheet, but again, these are huge contributors to the success and profitability of a company like Apple; the company is viewed as a center of innovation, and if it were not doing any innovating, it would very quickly be seen as a middleman for some other company's ideas and products. A company can't sustain that position for long even if it's raking in the money in the meantime.
Overall, the value of a company is generally a combination of these two things; by owning a portion of stock, you own a piece of the company's assets, and also claim a piece of their profits. A large company with a lot of material assets and very little debt can be highly valued based solely on the sum of its parts, even if profits are lagging. Conversely, a company more or less operating out of a storage unit can have a patent on the cure for cancer, and be shoveling money into their coffers with bulldozers.