The reason for these occasional insertions is that civil clock time is based on "Coordinated Universal Time" (UTC) which is maintained by (extremely precise) atomic clocks. In contrast, the rotation of the Earth is irregular and is not fit for accurate time keeping. A clock day has exactly 86400 SI seconds, whereas the mean solar day (a result of the rotation period of the Earth, and the revolution period of the Earth around the Sun) slightly increases in length mainly due to the tidal acceleration of the Moon. Thus, in order to not go out of step with day and night, UTC is corrected by a leap of 1 second every 18 months or so.
The instruction to insert a leap second will be given whenever the difference between UTC and GMT becomes 0.9 s. The insertion only ever occurs at the end of 30 June or 31 December. It is implemented as follows: after clock time 23:59:59, an additional second at 23:59:60 is counted, before the clock jumps to 0:00:00 of the next day.
It is the responsibility of the [International Earth Rotation Service]? (IERS) to announce leap seconds; between January 1970 and November 2001, the IERS gave instructions to insert a leap second on 22 occasions.
See also: leap year