An investor becomes a part owner of a company when he buys stock in that company, but it's a very limited type of ownership. In addition to possessing the small degree of voting power that comes with being a stockholder, an investor is technically entitled to a portion of the company's assets and earnings. However, this does not necessarily guarantee that an investor will make money without selling an appreciated stock. That said, there are still ways a shareholder can get cash without selling.
A cash dividend is one of the few ways that an investor can receive a share of the company's earnings without liquidating a position. Keep in mind, however, that companies tend to issue dividends only when they have excess earnings—and even then, the company may choose to reinvest those earnings in the company. However, dividends tend to show strength and an expectation that the company will continue to outperform, making the stock more attractive to investors, ultimately increasing its stock price.
Companies who pay dividends don't always do so in cash payments to shareholders. Some use dividend reinvestment plans, or DRIPs, which are attractive to investors because they can increase their equity position without investing additional cash.
Growth Vs. Maturity
An interesting side note about companies that regularly declare dividends is that these companies rarely pay a reduced dividend or fail to issue one entirely. As regular dividend payments indicate financial strength and optimism for future performance, the failure to do so signals to investors the opposite—the possibility of financial difficulties, such as declining sales revenue, for example. (See also: Is Your Dividend at Risk?)
That said, companies that are currently in a growth phase tend to reinvest most, if not all, of their earnings back into new projects, leaving investors with no way of taking cash out of their investments other than by selling their shares.
Essentially, if you want to derive income from your stocks without actually selling them off, your best bet is to choose blue-chip stocks like IBM, Coca-Cola and Walmart, that have reached a mature level where earnings are fairly consistent, management is stable, and there is a long history of dividend payments. Barring that, there's no real way to realize a profit from your investments without liquidating them, assuming, of course, they've appreciated since you bought them. (See also: How Dividends Work for Investors and The Importance of Dividends.)