Image: via Flickr.

It takes most people their entire career to save up enough money to retire comfortably by using IRAs and other retirement accounts to help them make the most of their investments. Yet when it comes time to take money out of an IRA, failing to follow the rules can be a costly mistake. With that in mind, let's take a look at the IRA distribution rules that most often trip up people and how you can make sure you follow them correctly.

When you can take money out of an IRA
The best-known rule about IRAs is that if you take money out too early, you'll pay a penalty. The magic age for penalty-free IRA withdrawals is 59 1/2, but if you take withdrawals before that, you'll have to cover a 10% IRS penalty on top of any tax liability you owe from any traditional IRA withdrawal that gets added to your taxable income for the year.

Note that there are a number of exceptions to the 59 1/2 rule that you can use to avoid the 10% penalty. Specifically, up to $10,000 of withdrawals you make to pay for a first-time home purchase, qualified educational expenses for yourself or your family, health insurance if you're unemployed, and un-reimbursed medical expenses in some cases can avoid the 10% penalty. In addition, beginning a program of substantially equal periodic payments, or SEPP, also gives you penalty-free access to IRA money before reaching 59 1/2. But keep in mind that SEPP plans last a minimum of five years with no provisions for penalty-free cancellation of the program.

There's also a tricky rule with Roth IRAs. Most of the time, distributions from Roth IRAs are tax-free. But even if you've turned 59 1/2, you might owe tax on a Roth distribution if you've had a Roth for less than five years. Even if that applies, though, the tax only affects income generated from the Roth, leaving the original investment untouched.

When you must take money out of an IRA
Many retirees prefer to live off other sources of income, such as Social Security and employer pensions. As a result, they'll leave IRAs untouched for as long as possible. For traditional IRAs, though, there's only so long you can go without taking IRA distributions. The IRS requires minimum distributions, or RMDs, beginning at age 70 1/2.

To figure out how much you have to withdraw, you take your IRA balance as of the end of the previous year. You then divide the balance by a life-expectancy number from an IRS chart. The answer gives you the amount of your RMD for the year. If you don't withdraw at least that amount, you'll owe a 50% penalty on what you should have withdrawn. That makes it important to get started as soon as you're required to.

Roth IRAs have no RMD provisions, however. That means you can leave Roth IRA money in your account as long as you want throughout your lifetime.

When your heirs must take IRA distributions
After your death, a new set of IRA distribution rules applies to your retirement account. 

Generally, anyone who inherits IRAs has a couple of choices. First, they can extend IRA withdrawals over their life expectancy, with required minimum distributions of their own kicking in immediately. Alternatively, they can take a lump-sum payment, or, in some cases, they can take distributions over a five-year period. Each of these provisions is designed to ensure that the IRA doesn't go on forever, although life-expectancy-based payouts can keep a retirement account going for decades beyond your death.

If you're married, your surviving spouse has two options: either roll over your IRA into the spouse's own IRA, or follow the same rules that apply to non-spouse IRA beneficiaries.

One thing to remember is that if the original IRA owner died before taking out the required minimum distribution for the year, the heir will immediately need to take out the RMD amount. Failing to do so causes the same 50% penalty that applies during the IRA owner's lifetime.

After spending so much time and effort saving for retirement, the last thing you want to do is to make mistakes when you withdraw your hard-earned money from an IRA. By knowing the IRA distribution rules, you can make sure that as much of your savings as possible goes toward what you want.