Well a pitcher is worth a thousand words ( http://www.arduino.cc/playground/uploads/Learning/solenoid_driver.pdf
This shows how a NPN transistor is commonly used to allow an Arduino output to switch devices on and off that require higher voltage and/or current then can be supplied directly by an output pin. This example shows operating a solenoid, but it could be any 12v device, motor, lamp, buzzer, etc. What first has to be known is the voltage and current requirements of the device that you want to operate. Only then can you pick the specific npn transistor so that it can handle that current and voltage ratings. These applications are pretty simple for a transistor in that the device will be always on or always off. Using transistors in linear applications, like audio amplifiers, etc are more complex.