According to the Gregorian calendar, which is the civil calendar in use today, years evenly
divisible by 4 are leap years, with the exception of centurial years that are not evenly divisible
by 400. Therefore, the years 1700, 1800, 1900 and 2100 are not leap years, but 1600, 2000, and 2400
are leap years.
This is done because the true length of the year is about 365.2422 days. Adding a
leap day every four years brings the average to 365.25, which is too big.
Subtracting a leap year every 100 years brings the average down to 365.24,
which is too small. Adding a leap year back every 400 years brings the average
to 365.2425, which is not perfect, but it's close. I think I remember reading
somewhere that under the current regimen, every 4,000 years we are supposed
to subtract the leap year back out again.
That makes the average 365.24225, which is almost perfect.
According to Calendrical Calculations by Ed Reingold and Nachum Dershowitz, 1700 and 1800 either were or weren't leap years, depending on the country in which you lived. The Gregorian calendar, currently used in the United States, was instituted by Pope Gregory xm in 1582, replacing the J ulian calendar. The Julian calendar - the one that simply put in a leap year every four years-made the year a tad too long, so the first day of spring - which gets measured astronomically - was sloooowly marching (pun intended) earlier.
By 1582, the vernal (spring) equinox was ten days early. It had continued to drift earlier since Caesar instituted the Ju1ian calendar in 45 B.C. until the Council of Nicea locked in the then-current alignment in A.D. 325. But between 325 and 1582, ten more days of error had accumulated.If something were not done, the first day of spring would slowly regress all through the year. Since the date of Easter depends on the vernal equinox, this would eventually force us to have both Easter and Christmas on the same day! Pope Gregory fixed this by tossing out leap years for three out of every four centuries, as I indicated; but he still had to deal with those extra ten days. So he declared that Thursday, October 4,1582, would be followed by Friday, October 15, 1582, to get the numbering right. The only problem was that the Catholic countries followed the pope's rule right away, while Protestant countries gradually adopted the new calendar.
In a nutshell, the year is now defined in terms of a certain number of vibrations of a cesium atom. But the "real" year is whatever the earth really does. Reality and the definition are slightly different, to the tune of about two milliseconds a day. So over the course of about 500 days, the error accumulates to about a full second. At that point, the Naval Observatory atomic clock inserts an extra second into time to keep the error under a full second. Although the USNO clock knows the time very accurately, it only reports the time to the second. The last leap second was inserted at the end of 1998, so there really was a time 11:59:60 on New Year's Eve in 1998!