Leap days occur roughly once every four years, and are inserted into our calendar to ensure that the calendar months remain synchronised with the Earth's seasons.
The Earth's seasons change as the Sun moves between the northern and southern skies in an annual cycle. When the Sun is among the northern constellations, it is summer in the northern hemisphere, and when it is among the southern constellations, it is summer in the southern hemisphere.
This cycle is called the tropical year, and repeats once every 365.2422 days. This period is almost, but not quite, equal to the time it takes the Earth to complete a single orbit around the Sun.
If every year had a fixed pattern of either 365 or 366 days, then the seasons would either drift 0.25 days later each year, or 0.75 days earlier.
From Roman times until the 1580s, this was avoided by using the Julian calendar. In the Julian calendar, an additional day was added to every fourth year, on February 29. The average length of each year was 365.25 days.
In the 1580s, however, it was realised that even the Julian calendar was not entirely satisfactory. The seasons repeat once every 365.2422 days, and yet for the past 1600 years, a calendar had been used where years lasted for 365.25 days. Although a small difference, this discrepancy of 0.008 days per year had been accumulating over time.
By the 1580s, the dates of the solstices and equinoxes had drifted by 10 days since Roman times. This caused problems for the church authorities, as the date of Easter is fixed relative to the March equinox. Should they use the traditional date from Roman times, or the date when astronomers actually observed the equinox?
In the Gregorian calendar, the system of leap years was refined so that the first year of each century was not a leap year, unless it was divisible by 400. This removed three leap years every 400 years, reducing the average length of each year to 365.2425 days. In addition, ten calendar days were skipped in the transition from the Julian to the Gregorian calendar, so as to restore the equinoxes and solstices to the dates when they had taken place in Roman times.
In Britain, the Gregorian calendar was not adopted until 1752, by which time eleven days had to be skipped, due to the leap day which had been inserted into the Julian calendar on 29 February 1700.
Although a slight discrepancy from the length of each tropical year remains, this is only 29 seconds – adding up to one day every 3,030 years.