The day before the stocks are issued, the underwriter and the company must determine a starting price for the stocks. A target price will have been set early on in the process, but IPOs are rarely stable. Obviously, the higher the price, the more money the company gets; but if the price is set too high, there won't be enough demand for the stocks, and the price will drop on the aftermarket (the open financial markets where the stock will be traded after the initial offering). The ideal stock price will keep demand just higher than supply, resulting in a stable, gradual increase in the stock's price on the aftermarket. This will lead to praise from market analysts, which will in turn lead to increased value down the road.
Who gets to buy the shares during an IPO is a complicated matter. In most cases, your typical, individual investor doesn't get access to these offerings (see The Google IPO to read about an exception). Instead, the underwriter gets to allocate the shares to associates, clients, and major investors of his choosing. Most of the shares (about 80 percent) will go to institutional investors, which are major brokerage firms and investment banks, and a few high-profile individual investors. The remaining shares that do make their way to small-time, individual investors are hard to obtain: Stock brokers usually only offer access to IPOs to higher volume traders, traders with no history of flipping stocks, and traders with a long-term relationship with the broker.
After the initial offering, the stocks hit the open stock market, where they begin trading at a price set by market forces. IPO stocks tend to trade at a very high volume on that first day -- that is, they change hands many times. Some IPOs can jump in price by a huge amount -- some more than 600 percent. Many IPOs do poorly, dropping in price the day of the offering. Others fluctuate, rising and then dipping again -- it all depends on the confidence the market has in the company, how strong the company is vs. the "hype" surrounding it, and what outside forces are affecting the market at the time.
After about a month, the underwriter issues a report on the IPO, which is always positive. This tends to give the stock a slight boost. After 180 days have passed, people who held shares in the company prior to its going public are allowed to sell their shares.