A test pilot is a person whose job consists of flying aircraft for the purposes of collecting information about flight. More specifically, it is a pilot who flies aircraft in manners dictated by other people, usually engineers, to determine if the airplane or the system being tested is safe and effective, or to determine the performance of the airplane or system. It can be, as you might imagine, a dangerous job.
Flying, or the task of piloting, is one of the most routinized and procedural jobs out there. This is because it can be an extremely complex activity, and one in which the pilot may at some point in their career encounter conditions which, despite their never having experienced the conditions before, they must be able to safely handle. The best way to ensure the survival of pilots and passengers in an activity which is characterized by chaos theory and fluid dynamics is to ensure that pilots have been given routines or checklists to both manage complex tasks and to ensure that they will respond in a manner which (hopefully) has been shown to be their best option for safety even if it is counterintuitive.
But, naturally, someone must run these checklists or experience these conditions first, for real, so that later pilots will have confidence that their training will really help them. Also, whenever a new aircraft is designed and built, somebody has to be the one to take it up in the air for the first time, and despite the advances of computer modeling and predictive engineering, you really just don't know what's going to happen until you do it.
Enter the test pilot.
The first test pilots were those individuals trying to build flying machines. Leonardo da Vinci would qualify, for example. The Wright Brothers would probably be most folks' bet for the first successful test pilots; they were not only testing their machine (the Wright Flyer) but an entire theory of aerodynamics. Famous test pilots, for example, have included such names as Chuck Yeager, Scott Crossfield, Joe Engle, Tex Johnston and Mike Melvill in the U.S.; Hannah Reitsch in Germany, and Georgi K. Mosolov in the USSR and Russia. This list leaves out the thousands of men and women who have risked their lives to make flying better, faster, safer and cheaper.
Nowadays, you can train specifically to become a test pilot at many aviation engineering schools. Test pilots need to be more familiar with the practice of engineering than regular pilots, since they need to understand the ramifications of their actions and the requirements and motivations of the engineers providing them with test aircraft and problems.
For some US Test Pilots, see: http://www.spacecovers.com/misc/testpilot_info.htm - For information on test piloting, see http://wright.nasa.gov