There are three types you will find here and there, and a fourth type used on high security buildings. Optical sensors only send a signal. It will activate anything you hook onto the system. That can be a door opener, an alarm, or it will turn on a security camera, whatever.
1. Active infared. We put a light emitting diode with a very narrow beam focused at a light sensitive diode on the other side of the door. The power is very low, only about .001 watt. The LED and LSD have to be "married" at the factory. If one goes, you have to replace both. The LED is polarized, so if the LSD shifts, it won't trigger whatever you have set on the LSD.
2. Passive infared or ultraviolet. PIR or PUV is the same setup except that you have a light emitting "key" that pulses across the beam and will activate whatever you set on it. You can set it to turn on or turn off. Stations with multiple keys can be set to record who came in, went out, etc.
3. Mass sensitive EHF. This system has an Extremely High Frequency transmitter (somewhat like a doppler radar). It will tell how tall you are and how much you weigh without you ever knowing about it. It can look deep inside you to see what is in your guts if they really have to know.
4. Composite. It will have any of the above in it, and if they put a scale under the doormat they can tell instantly who is there.
Most times you will just have a simple LED-LSD setup, and it will just open the door for you to the supermarket.