The Stock Market and corporations (they are intertwined), are 2 of the fundementals of modern business. Both allow the movement and strategzation of large investments that allow quicker investment and utilization of funds as needed by large corporations.
Basically, stock shares are a type of 'promisorry' note. The purchase gives you a theoritical piece of the company, along with a vote in some company decisions (Like CEO's and other top corporation officials, whether to sell or buy other businesses, etc.), with one vote for each share of stock you own. In return, the company returns a portion of it's profits (set by corporate guidelines) back to the stock holders on a quarterly, and annual basis. This is known as the 'dividend'. Again, the more shares you own, the more you get back (overall).
Okay, now what companies are doing when they sell stock shares is offering public shares of future profits, for present investments Publlically traded stock shares help companies raise large sums of cash for needed investments in short time fashion, without the nessesity of getting a loan from a bank and paying interest on a schedule. However, stocks may also be 'private', ie. held only by a limited number of individuals and not publically traded. The stockboard, which is elected by the shareholders, is the only body which the corporation has to answer to in spending and investment matters.
The stock markets (NYSE, NASDEQ,S&P 500) are "futures" markets, where public stocks are bought and sold. The price the shares are sold at is based on many variables, such as: public demand, company profits, company worth, short-term and long-term goals and projections, management structure,etc. While the stock shares and dividends are 'real', the stock market itself is mostly psychological in nature. Prices rise and fall depending on where investors and professionals see the company/companies going. Money can be made both long-term and short-term through the purchase and selling of stocks. The call "buy low, sell high" has driven the stock market since it's inception.