Infrared phototransistors are almost like standard NPN transistors. NPN transistors require a current at the base to allow a large current to flow from the collector to the emitter. The infrared phototransistor operates on the same principle, however the small current is created by infrared light.
Shown below is one infrared phototransistor and one infrared LED. These are available in the easy to use T1 3/4 package. 50 IR LEDs were purchased for three dollars on eBay, and 50 IR phototransistors were purchased for seven dollars on eBay. Great deals!
Note the pinout of the phototransistor and LED.
Below is the basic diagram of how it works. If current is passed through the IR LED, the IR light will hit the IR phototransistor, causing the phototransistor to pass current.
Below is the actual schematic diagram of the test circuit.
The circuit is powered, and the IR phototransistor is blocked. The green LED is barely lit.
The IR phototransistor has been unblocked. Note that the green LED is partially lit, due to the infrared light coming from the lamp in the room.
Now the IR LED is powered, and the green LED is at full brightness. The camera captures the IR beam as purple, however in real life humans are unable to see the IR beam.