It's the big, bad "B word" that no investor wants to hear: bankruptcy.

When a company files for bankruptcy protection, chances are its shares will lose most -- if not all -- of their value, and that the company will be delisted from its exchange. That's bad news for shareholders.

But here's a fact that may surprise some investors: The securities of companies in bankruptcy can and often do keep trading, as there is no federal law that prohibits trading stocks in bankrupt companies. What investors need to know, however, is that trading in the shares of a company under bankruptcy protection is incredibly risky, and could result in the loss of your entire investment.

If a company in your portfolio has filed for bankruptcy, here's a primer to get you up to speed on what you should expect, and a look at just why it's so risky to trade in the delisted shares of bankrupt companies.

Chapter 7 vs. Chapter 11
Companies typically file for one of two types of bankruptcy protection under the federal tax code known as Chapter 7 or Chapter 11.

A Chapter 7 filing is the more nuclear option. It means that the company stops operating and all its assets are put up for sale by a court-appointed trustee, with the proceeds divvied up to the company's debtors in order of the seniority of the debt.

A Chapter 11 filing means that the company may undergo reorganization and continue to operate. Still, a Chapter 11 doesn't rule out the possibility of the sale. The entire company may be sold in what is called a Section 363 sale with the court's approval. That is generally not a good thing for shareholders, as there is typically not enough cash left over from the sale to compensate stock investors.

Regardless, in the event of Chapter 7 or Chapter 11, Lynn M. LoPucki, a professor at the UCLA School of Law and the founder of the UCLA-LoPucki Bankruptcy Database, warns shareholders to keep their expectations low.

"If a shareholder sees a company they own shares in has filed Chapter 7, it is near certain they'll receive nothing," he said. "If they see a company has filed Chapter 11, it's highly probable they will receive nothing."

Chapter 11 reorganization and investor compensation
When a Chapter 11 filing doesn't result in a Section 363 sale, however, it may provide a small glimmer of hope for investors seeking to recoup at least some of their money. That's because reorganization plans sometimes include provisions for shareholder relief.

To reorganize under Chapter 11, a company must negotiate a reorganization plan with a government-appointed committee of company stakeholders, which is typically made up of creditors and can also include company stockholders. The plan will stipulate how much of the company's debt it will pay off, how much it will discharge, and it may also offer shareholders some sort of compensation for their shares.

The plan is typically put to a vote, but even if creditors or stockholders reject the plan, the court may still determine that the plan is fair and should be implemented. (For more information on how reorganization plans are structured, see the SEC's Corporate Bankruptcy page.)

In a small number of cases, shareholders may receive substantial compensation -- such as cash or shares in the new company -- if the company that filed for Chapter 11 protection was in relatively good health and chose to pursue bankruptcy protection for strategic reasons. Reorganizing under Chapter 11, for instance, can help a company to reduce payments owed for damage claims.

But more often than not, shareholders of bankrupt companies see little to no compensation for their investments. Cases in which old shares may be exchanged for shares in the newly reorganized companies are especially uncommon. A study by then-UCLA law student Andrew Wood -- using information from the UCLA-LoPucki database -- found that among 42 Chapter 11 reorganizations taking place between 2009 and 2010, just four included "substantial" recoveries for equity holders in the form of shares in the newly reorganized companies.

In many cases, shareholders were offered the right to purchase new warrants -- which allow investors to buy new shares in the reorganized company at a set price before a certain date -- in the reorganized companies. But Wood noted that the companies didn't provide projections for the warrant values and couldn't be considered as anything more than a "nominal" recovery for shareholders.

"By purchasing the warrants instead of receiving them, the classes being given these rights would in fact be giving up additional value, not receiving new value," Wood wrote.

Theoretically, if the company's share price exceeds the set price in the warrant, investors can in fact make money by exercising the warrant and selling the shares at market value. If the company's shares don't exceed the set price, however, investors are out of luck.

"The warrants are a way of making investors feel like they're getting something even though in the majority of cases, they're getting nothing," LoPucki said.

Trading after bankruptcy: a high-risk gamble
Companies that file for Chapter 11 bankruptcy protection often fail to meet the listing requirements of the major exchanges -- and are subsequently delisted. Still, they may continue to trade over-the-counter through the interdealer quotation systems OTC Bulletin Board, which is operated by the Financial Industry Regulatory Authority, or OTC Pink, run by OTC Markets Group. (OTC Pink was once known as "The Pink Sheets," a name that harkened back to the days when stock quotations for over-the-counter securities were printed on pink paper.) Bankrupt companies typically have the letter "Q" appended to the end of their stock symbols to denote the bankruptcy.

Such shares can trade relatively actively in the over-the-counter market, according to a study by Rutgers University and Temple University of 602 companies that filed for Chapter 11 bankruptcy protection between 1998 and 2006. More than 50 percent of the 602 stocks traded on any given day, including companies that had been undergoing the Chapter 11 process for as long as three years. But researchers found that, for the most part, investing in the stocks of the bankrupt companies in their sample didn't pay off, noting that "betting on these stocks on average generates large losses," generating median monthly returns of negative-15%.

Given such outcomes -- and the high likelihood that investors will receive no compensation for their shares through company reorganizations plans -- why do some investors snap up shares of Chapter 11 companies?

For one thing, investors may be subjected to misinformation. FINRA issued an Investor Alert in 2009 warning that, following General Motors' bankruptcy, investors may have been led astray by rumors about GM stock through newsletters, online message boards, and websites.

Investors may also operate under the false assumption that once a company has emerged from bankruptcy, their old stocks will regain value. In fact, the opposite is true: most reorganization plans, once put into effect, cancel existing shares. Only "new" shares -- those issued by the reorganized company under a new trading symbol -- have value.

"Investors should understand that buying common stock of companies in Chapter 11 bankruptcy is extremely risky and can lead to financial loss," FINRA said in its Investor Alert.

In the case of GM, investors who held shares of the company before its reorganization saw their equity holdings cancelled in March, 2011. Per the company's reorganization plan, they did not receive any shares of the "new" GM.

For his part, LoPucki suspects that many investors don't understand the odds, and continue to cling to the hope that they might hit on the rare case of a company recovering and notching investors big returns, like the case of AMR Corp., the parent company of American Airlines, which emerged from bankruptcy under a reorganization plan that The Wall Street Journal called a "bonanza for investors."

The story of American Airlines notwithstanding, though, investors should remember that its case is an exception, not the rule, when it comes to shareholder returns in the wake of a company's bankruptcy.

"For the vast majority of shareholders," LoPucki said, "your shares are going to be wiped out."

An Alert Investor is a smarter investor.

This article originally appeared at The Alert Investor.