By Roman custom, the day added is actually February 24th, with the days following it renumbered. The Romans had marked days during a month: 1st (called calendae--hence "calendar"), 5th or 7th (nonae), 13th or 15th (idus). On these days important events like markets, festivities, and rituals took place. It is possible that in ancient times attempts were made to keep the months in sync with the [lunar phases]?: on occasion an additional day would be inserted inter calendae (hence "intercalary"), i.e. somewhere between those days that should be kept fixed. Now our leap day would repeat the 6th day before the 1st day of March (count including the 1st day itself, as was their custom): hence "bissextile" day, which falls to 24 Feb.
The rule specified by the Gregorian calendar for leap years is as follows:
The logic behind the above rules is as follows:
By adding a day every four years, an average year is adjusted to 365.25 days. However, this still causes a discrepancy with the actual 365.2422 days period. To make the average year more accurate, a leap year is cancelled in each century. This removes 0.01 days to bring the average to 365.24 days. Unfortunately this is still not accurate enough, hence the cancelled leap year returns once every four centuries. That adds back 0.0025 days to bring the average to 365.2425 days.
The adjusted average is still 0.0003 day ahead of the actual period. As a result, the Gregorian Calendar will still run a day ahead every 3333 years. A proposal has been made to add an additional rule: that years divisible by 4000 are not leap years. This has not been accepted, since the change of the length of the tropical year over a period of four millennia will overwhelm any small gain in accuracy by this rule.
Notice that the leap year does not have anything at all to do with leap seconds, which are added occasionally based on actual observations of the rotation of the Earth around its axis.