Why do we have leap year anyway?
The regular calendar has 365 days, but it takes 365 days, five hours, 48 minutes and 45 seconds for the Earth to orbit the sun. That means the calendar falls behind the seasons 348.75 minutes every year.
Who cares if the calendar falls behind the seasons?
The people of Arizona and parts of Indiana.
How does leap year fix it?
Every four years we are 1395 minutes behind (348.75 times four), so we add a day (1440 minutes).
Wait, 1395 doesn’t equal 1440, aren’t we adding 45 too many minutes?
You are wise beyond your years. Every 100 years (25 leap years times 45 minutes) there would be 1,125 minutes too many. Eliminating leap year every 100 years tips the balance back toward even. That’s why there wasn’t a leap day in 1700, 1800 or 1900 and won’t be in 2100. But we did have a leap year in 2000 (and will again in 2400) to tweak it back a bit the other way.
Does that do it?
No, even then the intelligent design is such that the calendar will be off by a day in a few thousand years. Nothing’s perfect.
Leaping Calendars is a very good post on the Julian-Gregorian calendars history.