Are you considering investing in a company in or near bankruptcy? Think twice. Yes, it's true that companies such as the following have filed for bankruptcy protection and then re-emerged:

  • Kmart, which is now part of Sears Holdings (NASDAQ:SHLD)
  • Western Union (NYSE:WU)
  • Delta Air Lines (NYSE:DAL)
  • Marvel Entertainment (NYSE:MVL)
  • Continental Airlines (NYSE:CAL)
  • W.R. Grace (NYSE:GRA)
  • Winn-Dixie

But don't get the wrong idea about how shareholders fared. For instance, if you were a Kmart shareholder before the company filed for bankruptcy protection, you didn't get shares of the newly emerged company. Instead, you got nothing.

Nuts and bolts
Here's how it typically works: A company files for Chapter 11 bankruptcy protection -- usually extremely reluctantly -- when it's having trouble paying its bills. Under Chapter 11, it can continue to operate while it reorganizes. With some luck, it gets its act together and becomes stronger than before, as Western Union did.

If the company cannot generate enough capital to pay off its creditors, it will likely end up in a different type of bankruptcy, Chapter 7, where the company simply gets liquidated and the proceeds are distributed to investors.

In Chapter 11, the company remains in possession of its assets, under the administration of a court-appointed trustee. It must file a plan of reorganization with the bankruptcy court. If any creditors are to receive less than full value for their claims, they'll have the right to vote on their acceptance. After the vote, the court can accept or reject the plan. So the company has some flexibility, but if it tries to deal too harshly with creditors, its plan isn't likely to be approved.

In most cases, the company will have to sell assets to raise money to pay creditors. The proceeds usually won't be enough to pay all prioritized creditors in full, so the creditors might accept a reduced amount of money, in addition to some stock in the newly reorganized company.

Shareholders are last in line
There's a reason I'm spending most of my time talking about creditors and almost none addressing shareholders. Holders of common stock in the company are pretty much at the back of the line. They're behind debtholders, merchant creditors, trustees, employees, the IRS, and even preferred shareholders. Even the insiders' stock stakes usually end up worthless.

Bankruptcies in action
When trying to understand the bankruptcy process, it can help to look at a real-life example. So consider General Motors. Holders of its common stock stand way at the back of the line, behind creditors holding billions of dollars in debt.

With GM, shareholders weren't the only ones who lost money; even creditors were crunched. Some 54% of bondholders eventually voted to approve a plan to exchange their bonds for 10% of the newly emerging company, along with warrants to buy more of it later. Many times, bondholders end up with pennies on their dollars.

Also interesting is just how many creditors ailing companies can have. Apparently, Kmart had more than 1 million when it was facing bankruptcy -- including bondholders, banks, and suppliers such as Mattel (NYSE:MAT).

What to do
My best advice is this: Steer clear of companies in trouble. Some companies in Chapter 11 do emerge from it and survive, but many don't (think Enron, Worldcom, Polaroid, and gobs of others). And even with those that do, it's rare for old shareholders to benefit, as they're last in line to receive something from the bankruptcy.

Fool contributor Matt Koppenheffer has put together a bankruptcy preparedness kit for you. Read about it and see how you can protect yourself from dying companies.

Learn more about investing in troubled companies:

Longtime Fool contributor Selena Maranjian does not own shares of any companies mentioned in this article. Marvel Entertainment and Western Union are Motley Fool Stock Advisor selections. Sears Holdings and Western Union are Motley Fool Inside Value picks. Try any of our investing newsletters free for 30 days to learn about what kinds of companies you should invest in. The Motley Fool is Fools writing for Fools.