A stock represents a stake in a company. When you own a share of stock, you are a part owner in the company with a claim - however small it may be - on every asset and every penny in earnings.
Now, unless you own a significant chunk of one company's stock, it's not as if you have a real say in how things are done. Owning 100 shares of Facebook makes you, technically speaking, Mark Zuckerberg’s boss, but that doesn't mean you can call him up and give him a tongue-lashing. Nevertheless, it's that ownership structure that gives a stock its value. If stockholders didn't have a claim on earnings, then stock certificates would be worth no more than the paper they're printed on.