Can anyone tell me how does a light sensor work?
There are a few different mechanisms depending on how sensitive you need, how fast a response and how much you want to pay.
Generally the light either generates electricity or changes the electrical characteristics of an element in such a way that you can measure the change with a circuit.
Try googling "Photodiode".
Separate names with a comma.