Photo: Flickr user Wayne Silver.

Over many decades, the stock market has averaged an annual gain of close to 10%. That's a good number to keep in mind as you plan for retirement, as it can help you estimate how much you'll need and how much you must save and invest to get there.

Here's a little problem with this scenario, though: That 10% number is a rough average. It isn't what you will likely average over your investing years. You're pretty much guaranteed to do either better or worse than that, and while you can hope to do better, you should prepare to do worse.

A glance at some historic numbers should make that clear. Here are average annual returns for the S&P 500 over a number of decades, as presented by financial advisor Joshua Brown:

 Time Period

Average Annual Stock Return

1930s

(0.9%)

1940s

8.5%

1950s

19.5%

1960s

7.7%

1970s

5.9%

1980s

17.3%

1990s

18.1%

2000s

(1%)

2010s*

15.7%

1930-2013*

9.4%

Source: Shiller Online Data. *2013 data through Sept. 30, 2013.

Over relatively short periods (and when we're talking about the stock market, a decade isn't such a long time), returns can vary widely. As the periods get longer, they vary less. For example, here are some long-term average returns from Aswath Damodaran, a finance professor at New York University's Stern School of Business:

Time Period

Average Annual Return of Stocks

1928-2013

9.55%

1964-2013

9.89%

Source: Aswath Damodaran, NYU.

Stocks versus bonds
If volatility makes you nervous and you want to invest in bonds or something else other than stocks, think again. Over long periods, stocks have typically outperformed bonds. (They have outperformed real estate, too, so stop looking at your house as a path to riches.) Here is some eye-opening data from Wharton Business School professor Jeremy Siegel's seminal book Stocks for the Long Run, offering the average real returns for stocks, bonds, bills, gold, and the dollar between 1802 and 2012 (yes, that's 210 years!):

Asset Class

Annualized Nominal Return, 1802-2012

Stocks

8.1%

Bonds

5.1%

Bills

4.2%

Gold

2.1%

U.S. dollar

1.4%

Source: Stocks for the Long Run.

It's clear that over the very long run, stocks outperform bonds. What about over shorter periods? Well, check out these statistics from Siegel, reflecting how often stocks outperformed bonds over various rolling periods between 1871 and 2006:

Holding period

% of Time Stocks Beat Bonds Over Holding Period

1 year

60.3%

5 years

71.3%

10 years

82.4%

20 years

95.6%

30 years

100%

Source: Stocks for the Long Run.

Stocks again look better than bonds, but they're not guaranteed to outperform.

Source: InsiderMonkey.com via Flickr.

Exceptions to the rules
Here's a reminder that in your particular investing time frame, you might see results that are far from average: Between 1981 and 2011, bonds actually outperformed stocks. Of course, this wasn't really a freakish, unexpected occurrence. Remember that bond prices tend to go up when interest rates fall, and 1981 featured prime interest rates that topped 20% early in the year, versus the 3.25% rate that prevailed throughout 2011.

What to do
So now that you're armed with this historical perspective, what should you do? Well, as I said earlier, hope for the best but also prepare for the worst. After all, if you invest $10,000 per year for 25 years and earn an annual average of 10%, you'll end up with nearly $1.1 million. But if you only average 7%, your total will be just $677,000.

The solution is to save aggressively and to project returns conservatively. If you do, there's a good chance you'll end up with more (perhaps much more) than you planned to accumulate for retirement -- but that's not the worst problem, is it? If you don't manage to enjoy it all during your lifetime, there will simply be some left over for your loved ones.

You can earn the market's average return via a simple, inexpensive broad-market index fund that instantly has you in hundreds of diverse stocks. (The Vanguard 500 Index (VFINX) fund and the SPDR S&P 500 ETF (SPY 0.95%) are good examples.) You can also aim higher by putting some of your assets in carefully selected managed mutual funds or individual stocks, but these investments sometimes underperform the broader market. For most people, index funds are perfectly good long-term choices. You can juice your long-term results by socking away more than you originally planned.

Use an online calculator like this one to help figure out how much you might sock away and what it might grow into at different rates. Have an informed plan for your retirement, lest you end up surprised by below-average performances.