Fortunately, retirement accounts like IRAs are generally fully exempt from bankruptcy liquidation. Specifically, that means that when you file for a Chapter 7 (which is known as "liquidation" despite the fact that keeping all of your property is common), you will be able to keep 100% of your retirement savings - the trustee cannot sell it to pay off your debts like they could if you filed for bankruptcy with $50,000 cash in a checking account
instead, for example. The only real caveat is that the retirement account be of a particular kind. You cannot argue that your $50,000 cash you have in a savings account at your local bank is a "retirement account that I promise not to touch until I'm 65." Even if this were true, it clearly opens up the door for bankruptcy abuse and fraud. Therefore, any retirement account you have must be like the typical IRA, 401(k), or 403(b) type account. Generally, if it has tax-exempt status, it has bankruptcy-exempt status. The IRS Code details those accounts which are afforded this status.
The term "exemption," then, refers to that which is outside of your so-called bankruptcy estate. Consider that when you file for a Chapter 7, a new entity is created called "John Doe's Bankruptcy Estate" and in it goes all your assets...except those which are exempt from inclusion. The list of these exemptions includes, for the most part, your household furnishings, your clothes, your retirement accounts, and various other items as defined by statute. Some states (despite the fact that bankruptcy is a federal filing) protect their citizens differently; debtors in Pennsylvania can choose to use these state exemptions or elect to use the enumerated federal exemptions. A state like California has broad, discretionary exemptions (though no option to use the federal exemption schema) whereas a state like Oregon is a bit tighter with what it allows its citizens to exempt. Pennsylvania is in the middle and, fortunately, provides for a federal exemption option. Indeed, most Pennsylvania debtors elect to use the federal exemptions.
This John Doe's Bankruptcy Estate, if it has anything in it (again, only non-exempt assets are put in), is then sold by the bankruptcy trustee who oversees your case to provide some degree of cash payout to your listed creditors. Most filings are called "no asset" cases as there are no assets within the Bankruptcy Estate to sell and, therefore, nothing to sell for the benefit of the creditors. Incidentally, the trustee makes a few dollars off those things which are sold, which is why it behooves the trustee to be sure you have listed everything in your bankruptcy petition: they get a percentage of that which is liquidated. Any money collected by the trustee is distributed proportionally to the listed creditors based upon the size of the debt you owe them versus the overall debt that you owe.
Knowing how to maximize these exemptions is one of the key functions of a bankruptcy attorney. An experienced bankruptcy attorney can guide you to list your assets correctly and apply the appropriate exemptions to those assets (in the form called Schedule C). While you must list everything you own in your bankruptcy petition - for failure to do so constitutes fraud and subjects you to bankruptcy penalties - you should also be armed with an understanding of how to list your assets and the value to assign them. Again, a bankruptcy attorney can help you do this.