The earth is big and confusing, as is all the magma and magnetic and [insert another alliterative m-word here] magic that goes on inside it. To compensate for some of this magicky nature, the leap second was created.
To back up a moment, there are many different time-standards in use today, all of them slightly different, and each of them quite confusing. Two of the most common are the atomic-clock based UTC, and the solar based GMT standard.
As we have developed ever more accurate clocks, it's become clear that there aren't actually 24 hours (or 1440 minutes, or 86400 seconds) in each day. Though the difference is fractions of a millisecond, these inaccuracies snowball, and eventually the 'more accurate' UTC is no longer accurate and has strayed from GMT.
To compensate for this straying due to variations in the earth's rate of rotation, the leap second was created. Used only when deemed necessary by observation, it has no set implementation (unlike, say, a leap year which comes every four years, except every 100 years, except every 400 years). And that's the cool part. We have no way of modelling when a leap second will be needed. There's no predictive formula or simple rule. In essence, we have no idea how to predict variations in the rate of rotation of our planet.
And that's just freaking awesome.
And slightly concerning.