To save on battery life, there maybe some basic form of intelligenc ein there, such as a microcontroller. They can't leave the IR LED permenantly on, as this would drain the battery, but at the same time, it needs to be turned on regularly so it doesn't 'miss' someone placing their hand there. I suspect it turns on the IR LED for a very short period, every half a second or so, and once detected with a photodiode, double checks, then starts the pump.
There could also be a timer, so the pump doesn't constantly 'pump out' soap if someone leaves their hand there (waste of soap, and battery power).
I have noticed that these don't trigger in high ambient lighting conditions, so perhaps the IR LED is 'modulated' with a high frequency - the photodiode circuit only triggers when it detects this frequency (and so, ignoring 'DC' such as permenant light, and tv remote control signals).
Whilst all of this could well be in a simple analogue circuit, these days it is likely to be a very small microcontroller inside. This would reduce parts count, enable fine control over parameters, and increase battery life by going to sleep inbetween detections.
Just my two cents/pennies