Image source: Getty Images.

If there's one thing you need to do before you retire, it's this: Have a plan. The second most-important thing is to stick to that plan. Without a plan, you're leaving your retirement up to chance, and that can deliver some unpleasant surprises.

Plan to amass enough money and to make it last

First off, get out some paper and a calculator. Try to figure out how much income you'll need in retirement, and where you'll get it from. You can find out how much money you can expect to receive from Social Security via a visit to the Social Security website at www.ssa.gov. (To give you a rough idea, the average Social Security retirement benefit was recently $1,344 per month, or about $16,000 per year, while the maximum benefit for those retiring at their full retirement ages was recently $2,639 per month -- or about $32,000 for the whole year.)

If you're currently living on a $75,000 salary, or about $6,250 per month, and you want to live on at least $4,500 per month in retirement (that would be $54,000 annually), finding out that you might get $2,000 per month from Social Security means you'll need to come up with another $2,500 ($30,000 per year). If you amass a portfolio worth $750,000, and withdraw about 4% annually, that will be your $30,000.

Image source: Getty Images.

But how will you get to $750,000? Assess how much you've saved already, how much you're saving each year, how many more years you plan to work, and how rapidly you expect your money to grow. That will help you see whether you need to ramp up your savings, or even plan on working a few more years.

Your retirement nest egg will have to sustain you for the rest of your life. How much of it will you withdraw each year? A general rule of thumb is that withdrawing 4% of it in your first year of retirement, and then adjusting the annual withdrawal for inflation after that, is very likely to make your money last about 30 years, if it's split between stocks and bonds.

But that rule isn't a guarantee, and its usefulness depends on a variety of factors, such as market performance. Instead of following the rule strictly, you might use it as a rough guide, and withdraw more in years when the market surges, and less when it swoons -- or to be more conservative, use 3.5% instead of 4%. After all, your retirement might last longer than 30 years.

Be ready to change when you think you'll retire. Image source: Getty Images.

Plan to be nimble

Even if you draw up a thorough, detailed plan, prepare for surprises that life sends your way. The stock market might surge or swoon as you approach retirement, swelling or shrinking your nest egg. You or your partner might suddenly face a costly medical crisis, or one of you might lose your job, resulting in an earlier-than-planned retirement. It's good to have some "plan Bs" in mind -- such as possibly downsizing and moving in order to save money and live more inexpensively, working longer if you can, shedding a car if you have two or more, and so on.

Plan to be active in retirement

For a happy retirement, aim to be active. Many people find themselves aimless and restless in retirement without the structure of their old lives, and without the socializing that it offered, too. Find activities you enjoy, which might also include a part-time job. Find ways to socialize, such as by joining clubs or volunteering.

Exercise and eat nutritious meals in order to take care of your health. Not only will that likely save you money by lowering your healthcare expenses, but it can also make your retirement longer and more comfortable. Exercise your mind, too, by doing puzzles, or learning a language. Some studies suggest that that can keep you healthier, too.

Plan to start now

Finally, start developing your retirement plan now. It's easy to put it off, and that can be costly. If you need to be socking away $6,000 more per year, and you don't realize that and don't start doing it for another six years, you may end up with a nest egg that's $50,000 smaller than it could have been.

Start getting your financial ducks in a row today, and you'll be happy that you did -- perhaps for several decades of retirement. Don't leave everything to chance, relying on Social Security and good luck.