Leap years are a nifty solution to an ancient problem. Here's the science behind why adding a day every four years corrects the cosmic clock.