Stock markets are secondary markets, where existing owners of shares can transact with potential buyers. It is important to understand that the corporations listed on stock markets do not buy and sell their own shares on a regular basis (companies may engage in stock buybacks or issue new shares, but these are not day-to-day operations and often occur outside of the framework of an exchange). So when you buy a share of stock on the stock market, you are not buying it from the company, you are buying it from some other existing shareholder. Likewise, when you sell your shares, you do not sell them back to the company – rather you sell them to some other investor.
There is a number of different ways to trade stocks. You could trade through a mutual fund, entrust your money on an asset management, choose a broker or trade online on your own.
Placing your money with others to trade stocks is pretty much forward, so I won’t go into that for now.
Selecting a broker and how to trade on your own needs a bit more analysis.