How an IPO gets done, step by step

Edgar Su | Reuters·CNBC

Alibaba's long-awaited IPO is finally around the corner, making this a good time to take a look at just how an IPO works.

In an initial public offering ( IPO ) a company issues stock to the public for the first time. Why would a company want to go public in the first place?

  1. To raise money to grow the company. This is the most common stated reason.

  2. For liquidity. The company may have private equity investors who want to exit from their investment. It may have senior management that may be retiring or seeking to monetize their investment. It may want to reward employees with options.

  3. Balance sheet restructuring, i.e. they are raising money to pay down debt.

  4. Acquisitions: They need money to buy other companies.

  5. Talent recruitment: Going public gives a company a "currency" it can use to recruit talent.

What's next? The easiest way to visualize this is using a timeline.

The first step is a "beauty contest": You show off the company to bankers! The banker writes the legal documents and shepherds the company through the IPO process. The banker will "underwrite" the deal-that is, they will buy up all the initial shares and then sell them to the public at a predetermined price.

Which banker (or bankers) to go to? That depends.

Some companies already have close relationships to companies like Morgan Stanley (MS), Credit Suisse (Swiss Exchange: CSGN-CH), Goldman Sachs (GS), or others. One consideration is whether the bankers have an expertise in the space you are working in, such as biotech.

Another consideration is distribution. Most companies want as many investors as possible to own stock in the company. Some banks have broader distribution networks than others. Some have expertise in distributing stocks to institutions.

Read More Alibaba plans to open lobbying office in DC

Big firms may seem like obvious choices, but smaller regional or investment boutiques may have relationships with very specific investors that may be a better fit.

One thing's for sure: A company with a strong business will have many bankers competing for their very lucrative deal.

How lucrative? For a small IPO (about $100 million) it could be as high as 6 to 7 percent of the float. Generally the bigger the IPO, the smaller the fee, so a bigger, higher quality IPO would typically get charged 3 to 5 percent.

Alibaba is so big-the IPO is likely to raise more than $20 billion-that they likely got a substantial discount, charging something around 1 percent.

But even 1 percent is $200 million in fees!

Once the team of bankers (there could be more than one used, and usually is), lawyers, and accountants are decided upon, the banker will begin drafting an S-1 document.

This is the registration form required by the Securities and Exchange Commission (SEC). It's the legal document that tells the world about the company's plans for its proceeds, its business model, the competition, and its corporate governance, risks, and executive compensation.

Why does the company need to disclose so much information? The SEC wants as much transparency as possible to make sure investors have enough information to make intelligent investment decisions.

The document is then submitted to the SEC for their review. In the past, this filing was public, as well as any updates. Many companies were uncomfortable with this, because they were required to disclose detailed information to everyone-including their competitors-even if they ultimately decided to call off the IPO.

Read More One place you won't get Alibaba stock

Now, thanks to new legislation called the JOBS act, most companies (except the largest) can file confidentially.

There may be several "amendments" to the filing as the company updates financial information and adds additional details, such as what stock exchange they plan to list on.

Once the SEC approves the document, and they are satisfied there have been sufficient information and disclosures, the company can file a "public" S-1.

The company then launches a "road show," a tour to meet investors, which can occur 21 days after the public S-1 is filed. At the start of the road show, terms for the IPO are announced. The company will say they are seeking to sell, say, 10 million shares between $20 and $23.

How do they determine the price and size? Typically bankers will look at several metrics, including the present value of a company's cash flow, the value of the company in relation to sales or cash flow, or the value of comparable competitors who are already publicly traded.

On the other side of the transaction: How does the company determine how much they want to sell to the public? Typically, a company will float 10 to 25 percent of the company. The trend in the last few years has been to sell smaller pieces, then come back later with secondary offerings if there is sufficient demand. One important factor is liquidity. Investors want to make sure there is enough shares in circulation so that it can trade without glitches.

Read More So, what happens to Yahoo?

The road show is a critical step in the IPO process. What investors attend a road show? The whole spectrum: Hedge funds, mutual funds, banks, pension funds, endowment, and individuals.

Depending on the size of the company, there could be dozens of meetings in a couple weeks. A typical midsize company might meet with 50 to 100 investors at a luncheon, but it can vary.

In Alibaba's case, there were two separate teams that spread out to many cities, including New York, Boston, San Francisco, Denver, Kansas City, Chicago, London, Hong Kong, and Singapore. There were over 900 investors that showed up at the road show in New York.

During this process the company is also getting feedback from investors on demand for the stock. The bankers will be "building a book" of offers to buy the stock at various prices, and depending upon the demand they will adjust the price and the number of shares they are going to offer.

It is fairly common for investors to put in a request for more shares than they really want, because most do not get a full allocation. That is a red flag, by the way: If you're not a top client of the bank and you get a full allocation, many think that's a bad sign.

Read More Slideshow: Memorable IPO moments

At the end of the road show, when the orders are all consolidated, the bankers will announce a final price and deal size. Investors who put in bids to buy the stock will find out how much they were able to buy, assuming the price was acceptable to them.

How do you determine the final price and size? It's a little art, and a little science, but demand is the most critical factor.

The day after the stock is priced, the company goes public ... hopefully. There's one other factor that plays into a company's decision on when to go public: Market conditions. Sometimes, the stock market is in turmoil. You don't want to go public if you can avoid it when that happens, because it may hurt how the stock trades on the first day.

This is the big day. The CEO, the senior management team, and family members will often assemble at either the New York Stock Exchange or the NASDAQ (NDAQ) for the first day of trading, depending on which exchange they chose.

Let's say the company has decided to sell 10 million shares at $20, a $200 million offering. The bankers have bought up those shares and will have sold them to investors at that price. Most IPOs also give the underwriter the right to sell an additional 15 percent more (known as the "greenshoe") if there is sufficient demand.

But that doesn't mean the stock will open at $20. The opening price will be determined by the demand on the part of all the investors who didn't get stock but want it, as well as by investors who got stock but want more.

Read More Four-star fund manager is passing on Alibaba

There's another factor: How many investors who got stock want to sell. If many perceive that the stock may not be a good deal long-term, they will sell quickly. Or the opposite could happen. Everyone wants to hold the stock, and so the price goes up.

Bankers typically like to set the IPO price just high enough to have it open modestly on the upside. Many aim to have the price up 10 to 15 percent on the first day. That's generally considered to be a "successful" IPO.

Investment banks who are part of the underwriting team cannot publish research until 25 days after the company goes public; 40 days in the case of big companies like Alibaba. However, investment firms that are not part of the underwriting process can publish research at any time.

Read More Don't care about Alibaba? Here's why it may matter

The "lockup" period for most companies ends, and insiders are free to sell shares.

This is a convention, however, not a rule. Alibaba, for example, has a tiered lockup. For insiders with small amounts of stock the lockup ends after 90 days, and for all others ends after 180, except for Jack Ma and a few other executives (including Yahoo (YHOO) and Softbank (Tokyo Stock Exchange: 9984.T-JP)), which have a one-year lockup.

-By CNBC's Bob Pisani

Advertisement