Leaderboards are essentially a multiplayer implementation of the high score system found in a variety of arcade and pinball games. However, they differ in the sense that online leaderboards may track a variety of statistics, whereas an arcade game's scoreboard only lists high scores from players who have played the machine in person.
What a leaderboard measures is entirely up to each individual developer's implementation of a leaderboard in a game. Some games may only show leaderboards for game completion times, placing emphasis on pure speed runs without accounting for other statistics. Others may track a variety of statistics, even the more obscure and quirky ones.
In addition to multiplayer leaderboards, there are also leaderboards for some single-player games; for example, a developer could include leaderboards for how fast the game was completed and how many kills a player has attained.
Many games now implement a separate leaderboard for people on your friends list. For example, Steam games may import your Steam friends' list, and display a leaderboard that narrows the player list down to just those that appear on your friends' list. This allows players to have a more personal rivalry with people they are already familiar with as opposed to competing for position against random strangers.
Microsoft mandates that all Xbox Live Arcade games contain leaderboards. These leaderboards can be adjusted to see only the player's status amongst his or her friends, or they can view the player alongside the entirety of people who have played the game while connected to Xbox Live. The leaderboards in Xbox 360 retail games work in a similar fashion, but retail games are not required to include leaderboards.