A mercenary is a soldier who contracts out his services as a private individual, as opposed to being part of a state's regular armed forces.
Mercenaries were common until the 18th century. During the Renaissance, many Italian city-states had no standing armies and relied entirely on mercenary forces. The British used them during the American Revolution, and everyone used Swiss mercenaries at one point or another. However, even then many thinkers foresaw the dangers in using mercenaries. Machiavelli wrote that a mercenary, having no allegiance, will eventually hold the prince who employs him hostage for increasing amounts of money.
The widely held image of the notoriously undisciplined, cowardly mercenaries who roam the land looting, raping, and murdering, however, is (mostly) wrong. A mercenary is a businessman, first and foremost, and as such is dependent on someone to hire him. So those mercenaries whose behavior does not advance the goals of an employer would be driven off the market (or into the ground) by those who aren't.
Most (although of course not all) examples of mercenaries deserting their employer or terrorizing the population were and are results of them either not being paid or being allowed or maybe even encouraged to do so by their employer. Wallenstein's historical concept of "war that feeds the war" would be one example, Academi, née Blackwater, in Iraq might be considered a second one.
After the advent of nationalism in Europe, the use of mercenaries declined sharply, such that none were used in the great wars of the 19th century or in the world wars of the 20th. They were, however still used in Africa up into the 20th century. However, recently, the United States has been accused of using mercenaries, such as the "defense contractors" of Blackwater and others.
A cottage industry of magazines allegedly about the exploits of modern mercenaries, led by Soldier of Fortune, sprung up in the 1980s.