Typically, there are taxes and penalties if you withdraw money from a 529 plan and don’t use it for college expenses (more on this just below).
You’ll still have to pay taxes on the earnings (any investment gains from your original contributions), but that just means you’ll have gotten tax-deferred growth in the meantime. And in any case it’s nice to know that you won’t be penalized if your child is able to use his or her talents to pay for a college education.