Today is leap day. In order to accomodate the U.S. presidential election and the Summer Olympics, the years in which those events take place require an extra day, which is added on February 29. These events take place in years evenly divisible by four (2016/4 = 504), and for this reason, Pope Gregory decreed in 1582 that such years would contain 366 days, rather than the typical 365. The first leap year took place in 1584. Even though there was no presidential election or Summer Olympics that year, the new system showed incredible foresight.
The addition of a leap year also keeps the calendar in sync with the Earth’s orbit around the sun, which takes approximately 365-1/4 days. Without the modification to the calendar, the seasons would shift by about one day every four years.
However, the Earth’s period of orbit around the sun is not exactly 365-1/4 days. It is actually slightly more, but because of the effect of the Earth’s precession, it appears from the point of view of an observer on Earth to be slightly less, namely 365.24219879 days.
To get things properly in sync, a few more tweaks had to be made. Therefore, years divisible by 100 (which are divisible by 4, and would normally be leap years) are not leap years. Therefore, 1900 consisted of 365 days, and there was no February 29, 1900.
This correction by itself would make the average year measure 365 + 1/4 – 1/100 = 365.24 days. However, to refine the formula even more, another exception is made. Years divisible by 400 are leap years, even though they are divisible by 100. Therefore, 2000 was a leap year, and there was a February 29, 2000.
With this added factor, the average year length is now 365 + 1/4 – 1/100 + 1/400 = 365.2425 days, which is only 0.0003013 days more than the actual length of the year. This means that it will take 3319 years for the calendar to be off by only a single day. But that seems to be an adequate distance to kick the can, and our descendants can deal with the problem then.