Every investor wants the inside path to success. One way that many investors think they can get a huge edge over the competition is by getting in on initial public offerings of hot companies. Yet for every hot IPO success story you hear, you'll find plenty of cases in which buying at the first chance you got wasn't such a great idea.

The simple logic of IPOs
Initial public offerings may seem akin to a lottery, but behind every IPO is a fundamental economic fact: supply and demand. When demand for a newly offered stock is high, then you can expect a big pop during an IPO, especially if the company only offers a small fraction of its shares to new investors. When Google (Nasdaq: GOOG) went public, for example, it was in so much demand that it made even an unconventional Dutch auction process successful in the end. Conversely, when offerings are large or interest is muted, underwriters will struggle to get the deal done at all.

From that simple fact, you can draw a number of valuable conclusions. Here are a few.

1. You're not going to get hot IPO shares.
One reason IPOs are so popular is because for a select group of investors who get to buy shares at the offering price, they often become free money. It's so rampant that underwriters have gotten criticism for leaving so much money on the table.

Take E-Commerce China Dangdang (NYSE: DANG), for example. The stock priced at $16, but it opened its first day of trading at $24.50 and ended up closing at just less than $30 per share. Those who got in on the IPO got close to a double for their trouble.

Nor is Dangdang an isolated case. Qlik Technologies (Nasdaq: QLIK) went to lucky IPO recipients at $10 but closed its first day 50% higher. Home beverage-maker SodaStream International (Nasdaq: SODA) saw similar interest, going from its $20 IPO price to almost $35 in its first four trading sessions.

2. You can get rich without being on the ground floor of an IPO.
All that said, IPOs don't always lead to massive moves upward for the shares involved. In fact, you can end up much better off waiting in some cases.

For instance, take Molycorp (NYSE: MCP). The rare-earth poster child has taken off as a combination of Chinese export limitations and a huge ramp-up in demand has underscored the necessity of the metals for everything from industrial applications to national security. Yet on the first day the stock traded, it dropped -- by a whopping 8%, and went on the next day to close almost 12% below its offering price before beginning the rise that would eventually cause it to be last year's hottest IPO.

This happens more often than you'd think. Motricity (Nasdaq: MOTR) came public at $10 but sunk to less than $7 in the ensuing weeks before beginning its explosive rise. Tesla (Nasdaq: TSLA) opened at $19 and rose dramatically in its first day, but then slid to more than 15% below its offering price within a week.

3. Some IPOs fail.
Just because a company has an initial public offering doesn't guarantee it success. Bankruptcy courts and delisting notices are littered with companies that originally had just as much promise as today's hot IPOs but that failed to make good on their potential.

That should take the pressure off trying to get into every IPO. Paying too much for shares right after they come public can be a recipe for losses even if the company is mildly successful, let alone if it turns out to be a dud. The key is saving your ammunition for companies that have more than just hype behind them.

4. Some IPOs are never worth it.
Finally, many IPOs are almost guaranteed to cost you money. For instance, when closed-end funds come public, they build in an underwriting charge into the cost of shares. So if you pay $10, the fund only receives $9.50. In effect, you're paying a front-end load for shares that are worth less than your cost. And often, if you wait, you can pick up shares on the open market for closer to their true, lower value.

Stay smart
Initial public offerings are designed to tempt you with hype and glamour. But don't let the bright lights distract you from making a smart decision about whether to invest in them. By treating an IPO like any other investment, you'll take emotion out of the picture and get better results.

Some stocks are better than IPOs. Read the Fool's new special free report, and you'll find three stocks that would make Buffett's mouth water. Click here and see them for yourself today.