Today is February 29th, that weird occasion that only comes round once every four years and has deprived poor folks like Ja Rule of so many official birthdays. You probably know that its existence is something to do with the Earth orbiting the sun, but why exactly do we have leap years? And isn't there a better solution?
Today exists because our planet doesn't orbit the sun in a nice, whole number of of days. During one orbit of the sun—what we call a year—the Earth rotates just over 365 times. In fact, to be precise, it rotates 365.242190419 times. It's that messy bit after the decimal point, close to a quarter, that is the cause of the leap year.
Generally, westerners stick to the Gregorian calendar, commissioned by and named after 16th-century Pope Gregory XII. It has 365 days, so to keep in step with the orbit of the planet around the sun we have to include an extra day every four years, to make up for those lost quarters.
In fact, it's not quite that simple: To make up for everything after the .25 in the decimal, we have to skip some leap years. By convention, we don't include a leap day at the turn of the century—except those divisible by 400. So 2012 is a leap year, as is 2400, but 2100 won't be. All that fiddling is enough ensure that our calendar system only becomes out sync by one day every 8,000 years. Close enough.
It might seem tempting to scrap the leap year system entirely and, in many ways, we could. Life would by and large continue much the same as it does today. You would, however, notice one strange side effect as time progressed.
Basically, dates would drift in relation to the season. While those of us in the US are used to celebrating Christmas in the winter time—which, if you're in the North probably means cold and snow—without a leap year system, you'd find that Christmas eventually drifted.
It would be a slow process, though. It would take 100 years to lose 24 days, so it would be over 700 years before Christmas featured in the middle of summer, and 1,500 years before it occurred at the same point in winter again. So, the current system provides continuity between generations; it keeps dates fixed to seasons, and helps us rationalize the passage of time better.
In theory, there are many ways to achieve the same ends. In the sixteenth century, John Dee suggested a different system that would intersperse 366-day years across 33-year cycles. It's hypothetically better than the current system, because it simplifies the skipping of leap year—which we've seen is a bit tricky. But he never managed to convince enough people that shifting was a good idea, and it would be virtually impossible to instigate that change now.
To make matters worse, the length of the year isn't actually constant; Earth years are getting longer as the planet's rotation slows. Sadly, the lengthening isn't predictable, so as a result, timekeepers currently compensate by adding an occasional leap second. It's not a perfect solution, but it's the best we have right now.
What all this demonstrates is that calendars aren't really very mathematical. They're put in place to help us, as people, understand the passing of time, but they require fiddling and ad-hoc adjustments to keep them working properly.
Perhaps most importantly, it's worth realizing that in another 1,000 years it's incredibly unlikely that we'll still be using the Gregorian calendar. So for all the huffing and puffing about ensuring our calendar is as accurate as possible, in the grand scheme of things it doesn't really matter too much. Just ask the Mayans.