Bob Baerker outlined the two major forms of bankruptcy in the US.
In addition, when a company reorganizes under Chapter 11, a common strategy is to look for another company to acquire the assets of the business. Sometimes this company will acquire the bankrupt company as a whole -- it will typically become a division of the new parent company.
As far as the shareholders are concerned, this is similar to any other merger or acquisition, except the bankruptcy court mediates it, rather than allowing shareholders to vote on it. If the new parent company is a public company, the shareholders of the original company will have their shares converted to the new company; the conversion rate will be pro-rated based on the estimated fair market value of the two companies (I assume this is done by the bankruptcy court). If it's not public, the new parent company will purchase their shares from them (again, I presume the bankruptcy court sets the price).
Sometimes the new company doesn't acquire the business as a whole, but instead the company is broken up and some divisions are sold, while the original company continues to operate with the remaining divisions. When the remaining compoany emerges from bankruptcy, the shareholders will see the value of their shares drop based on the estimated value of the remaining business, and they'll receive either cash or shares of the new parent(s) for the divisions that are sold off.
I've worked for companies that have gone through both types of bankruptcies, although the one that was split up was a startup that hadn't yet gone public. In that case, some of my compensation was in incentive stock options, but they became worthless since we never went public.
Often the selloff strategy is attempted as a way to forestall bankruptcy. The reason the company is struggling is because it's trying to do too many things at once; selling some divisions to a company that it fits into better can allow the remaining company to be more manageable, and avoid having to declare bankruptcy. Once you declare bankruptcy, many decisions are forced upon the company by the court.