Why bankrupt firms continue to operate? Many firms in the United States file for bankruptcy every year, yet they still continue operating. Why would they do this instead of completely shutting down?
Well, obviously there's a reason behind this like it's less costly somehow. But I can't understand it completely, though. 
Can anyone explain this, please?
Declaring bankruptcy is a way to prevent creditors from seizing assets and pursuing lawsuits to recover what they are owed in a piecemeal fashion. It forces all parties to wait for a judgement that determines in what fashion various classes of creditors will be repaid.

In the United States, there are two main ways a private firm goes bankrupt - known as Chapter 7 and Chapter 11 (chapters of the bankruptcy act).

In a Chapter 11 bankruptcy, the firm aims to reorganise its debts. The typical outcome is that the original equity holders lose almost all control of the firm as subordinated debtors have their claims converted into equity claims. Other debtors may get paid only a percentage of their claim, or they are given new debt. What happens is determined by negotiation among the major creditors and firm management, overseen by the bankruptcy judge. By lowering the debt burden of the firm (and possibly eliminating pension obligations that cannot be sustained), the firm is hoped to then be profitable, and able to pay back the remaining debts.

Chapter 7 bankruptcy is a liquididation. All assets are sold, and then the proceeds are used to pay off debtors. However, the liquidation value of most assets is far below their carrying cost on the balance sheet, and so the recovery values are extremely low. The exceptions might be things like real estate, which another firm might be able to use in a more profitable fashion. From the prospective of creditors, the recovery value is typically much lower in a liquidation (barring special cases) - look at the prices for clothing in liquidation sales versus normal retail price. Industrial equipment is specialised, and the buyers know that this is a liquidation, and so they will only bid if prices are extremely cheap versus new equipment. However, if a firm tried Chapter 11 and fails to recover, it is more likely to give up and liquidate the next time.