There are two occasions when companies issue stock (shares in the company). The first occasion is the Initial Public Offering, or IPO. This is when the company is first being listed on a stock exchange, or spun off from another company and it issues shares to the current owners, then sells the remainder of the initial share offering to the public. A secondary offering can be made any point in the future when the company needs to raise capital.
Initial Public Offerings
IPOs are the bread and butter of Wall Street. The investment banks and stock brokerages all get their piece of the pie (significant fees and a percentage of the shares), and the owners of the newly listed company are giddy with their sudden liquid wealth, and everybody is happy (as long as the company prospers).
Secondary Offerings and Dilution
Secondary offerings are generally a less happy time in the life of a company. This is when a company has to issue more stock to raise cash for various reasons. If it is to raise cash to buy a new factory or acquire a competitor, then it can be argued that in the long run the secondary is good for the company, but in the short run it adds to the total number of shares outstanding, thus reducing the value of all of the shares. Secondary offerings are almost always made at a discount to the current market price, which means the current price will drop to match the price of the secondary.
Share Buybacks
Sometimes larger companies that have been profitable for a good while and have built up a good bit of cash will even buy back shares of their own stock on the market. This is considered a shareholder friendly thing to do as reducing the size of the float helps to drive the share price up.
Share Classes
Older companies and larger companies will often have several different classes of stock, that is preferred shares and common shares. Keep in mind that preferred shares often have conversion rights and are paid dividends (and first right of recourse in bankruptcy), but usually do not have voting rights.
Total Number of Outstanding Shares
The term total number of outstanding shares (or the float) means all the shares of all classes issued by the company, which of course changes over time as the company issues or buys back shares. You need to know the total outstanding shares to determine the key metric of earnings per share.