The reason for these occasional insertions is that civil clock time is based on "Coordinated Universal Time" (UTC) and measured using (extremely precise) atomic clocks. However, 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 product of the rotation period of the Earth, and the revolution period of the Earth around the Sun) is slightly longer. Due to the gravitational pull of the moon, the actual solar day is also increasing slightly over time. Thus, in order to not go out of step with day and night, UTC is corrected by a leap of 1 second whenever the [International Earth Rotation Service]? (IERS) declares it necessary. On average, a leap second is inserted every 18 months or so. (Between January 1970 and November 2001, the IERS gave instructions to insert a leap second on 22 occasions).
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.
As noted above, it is the responsibility of the International Earth Rotation Service to announce leap seconds: see [the IERS Bulletin]. Previous events are listed at [the IERS archive].