A share of stock represents limited ownership in a company. Owners get to select the Board of Directors and, if the Board of Directors approves, share in profits. Owners own the company's assets and are responsible for the company's liabilities.
Now... how much is a share of stock worth? Theoretically, a share of stock is worth the present value of all future profit for the company at its point of liquidation divided by the number of shares outstanding. Let me try to say that a little easier... over time, a company is expected to earn profit. If you sum up all of the future profits and then extract from those values the expected inflation rate in order to state the value in present-day's terms, you calculate what the entire company is worth today. Now divide that amount by the number of pieces that the company's ownership has been broken into (i.e. the number of shares of stock), and you get the value of a single share of stock.
Let's say that company A is going out of business today. They have $2,000 in assets and $1,000 in liabilities, and they divided the company into 1,000 equal pieces ownership. To calculate all future profit, subtract liabilities from assets (leaving $1,000) and divide that by the number of shares. Each share should receive $1, meaning that each share is worth $1.
A more complicated example...
Company B is going out of business in exactly one year. They have $5,000 in assets, $3,000 in liabilities, and they are expected to create and sell $20,000 worth of services over the next year, incurring expenses of $16,000. During the next year, we also expect roughly 1% inflation, so if something is worth $1,000 in one year, it has an inherent value today of $990.10 today ($1,000 divided by 1.01). So... in one year, the company will have $4,000 profit ($20,000 in revenue less $16,000 in expenses), increasing their assets to $9,000 ($5,000 today plus $4,000 next year). Once they pay off their $3,000 loan they'll have $6,000 left over. The $6,000 in one year is worth $5,940 today, so a share of stock is worth $5.94.
Now... different independent valuations of the same company can use a whole bunch of different underlying values. Let's say that, in the above example, someone else thinks that the company is going to have a particularly good year and have revenues of $25,000 with expenses of $19,000. Their valuation for the company would be that in one year they would have an $8,000 liquidation value, so today a share of stock would be worth $7.92. That's quite a difference from $5.94, so the person who valued the company at $5.94 might be very willing to sell their shares of the stock for $6.50, and the person who valued the company at $7.92 might be very happy to buy a share at $6.50, so they might strike a deal, and that is precisely how the stock market works.
Something important to note, here. Let's say that in the above example, the company was divided into 100 shares, not 1,000 shares. That means that each share might have a price of $79.20 rather than $7.92. While $79.20 is certainly a higher number than $7.92, the actual number provides absolutely no information about the worth of a company. A company with a share price of $50 isn't necessarily more valuable than a company with a share price of $10. A good example of this is to compare GOOG (Google) to MSFT (Microsoft). Google's share price is about $484.50, and Microsoft's is about $25.00. Does Google have 19.38 times the valuation of Microsoft? No!!! Google has been divided into 316,570,000 shares of stock, while Microsoft has been divided into 8,930,000,000 shares of stock. That's right, Google's share of stock represents a much larger part of the company (28.2 times the size, to be exact). So when we do the math, Google, as a whole, has a "market capitalization" of $484.50 * 316,570,000, or $153,378,165,000, while Microsoft's capitalization is $17.00 * 8,930,000,000, or $223,250,000,000, more than Google's valuation. So clearly, the actual price of a stock isn't as relevant as how much that price changes on a day-to-day basis.