Sometimes, things happen that make a mockery of all the planning you do. For example, say that you start diligently saving for your child's education shortly after his birth. You do some research and choose the 529 college savings plan that makes the most sense for you. For 18 years, you make monthly contributions into the 529 account. Then, in one sentence in your child's acceptance letter, your planning gets turned around:

"We are pleased to offer you admission to Acme College, with a full scholarship covering tuition and fees."

Suddenly, all the money you've saved toward your child's education may not be necessary. Yet you still have this savings in a tax-deferred account that you earmarked for educational expenses. Once your initial plan no longer applies, what's the best strategy to use for the money you've saved?

Tax breaks and penalties
529 plans offer extraordinary tax benefits for college savings. As your 529 account earns income during the years before your child begins college, you don't have to pay any income tax on those earnings. When your child starts college and you make withdrawals from your 529 plan to pay for college expenses, the earnings on your account effectively become tax-free. As long as you use the money within the 529 plan for college expenses, you'll get as favorable tax treatment as you can find anywhere.

In order to deter people from using 529 plans for purposes other than college educational expenses, however, there are some penalties involved if you withdraw 529 money and don't use it for your child's education. First, the tax deferral you enjoyed while the funds were in the 529 plan immediately ends, and any income you earned within the 529 plan becomes taxable to you. Second, the IRS imposes an additional 10% penalty on those earnings. For instance, say you invested $10,000 in an index fund and it earned $5,000 in dividends. Your child decided not to go to college, so you simply withdrew the money from your 529 account. You would not only pay tax on the $5,000 in earnings but also pay a $500 penalty.

Exception for scholarships
The law governing 529 plans recognizes part of the uncertainty in saving for college education. Whether your child goes to an Ivy League school, the local community college, or an online education provider like Corinthian Colleges (NASDAQ:COCO) or Apollo Group's (NASDAQ:APOL) University of Phoenix, it's virtually impossible to predict with great precision exactly how much money your child is likely to need to pay for college expenses. The law that establishes penalties carves out an exception for withdrawals made because of scholarships your child receives. If you withdraw funds from your 529 account that a scholarship allowed you not to spend on college expenses, then you do not have to pay the 10% penalty on the withdrawal. You do, however, still have to include the earnings as income on your tax return.

In addition, even if your child gets a scholarship, it may only cover tuition and related fees. 529 money can be used for a wider range of expenses, including room and board. After taking that into account, if you end up having money left in a 529 account for reasons other than death, disability, or a scholarship your child received, then you won't be able to avoid the penalty if you take the money out of the plan. On the other hand, you do still have some alternatives that can be beneficial.

Use it or keep it
One thing you can do with leftover 529 money is to use it for another child's college expenses. Most 529 plans allow you to do this by changing the beneficiary on the account to a new person, so you don't even have to open a new account or transfer assets from one plan to another. Obviously, this works best when you have more than one child of your own, but keep in mind that there's no restriction that requires that a 529 plan beneficiary be your own child. You can use it for nieces and nephews, grandkids, or even children of friends if you want.

If you don't have any current prospects who need college money, however, another option is simply to keep the account open. Although some 529 plans require assets to be used or distributed within a certain time period, many do not. Until you withdraw money from your 529 account, no tax or penalties will apply. This can be an excellent way to keep money aside for future use by grandchildren who haven't yet been born. Some commentators have even suggested that people could consider deliberately using 529 plans with the expectation that they will not use all the money for educational expenses, treating them instead as just another tax-deferred method of saving for retirement. For some, the value of the tax deferral may outweigh the penalty for not using the money for educational purposes. If enough people use 529 plans in this unintended way, it's likely that Congress and the IRS will move to increase penalties and take other action to deter people from using 529 plans for purposes other than paying educational expenses.

If your child is fortunate enough to get a scholarship, don't worry about all the money you've set aside for college expenses. With the options open to you, you can just relax and be happy about your child's accomplishment.

Related articles:

Are you struggling to meet all your financial goals? GreenLight can help. The Fool's very own personal finance service gives you new hints in every monthly newsletter that are designed to save you money and help you earn more from what you already have. Take a closer look at GreenLight with our 30-day trial.

Fool contributor Dan Caplinger can only hope that his daughter will score a nice scholarship, but that won't stop him from making those 529 contributions. He doesn't own shares of the companies mentioned in this article. The Fool's disclosure policy keeps you educated.