When did cells learn to see?
About two billion years ago, or maybe a little later, some eukaryote cells developed the ability to see. That was during the Proterozoic period, not long after the first cells evolved. Sight was one of the first things that cells wanted to have.
How do eyespots work?
Eyespots, like other parts of a cell such as lysosomes or golgi bodies, have a lipid membrane around them. Inside, they have as many as twenty different kinds of protein molecules. These often have a dark or reddish color, as you can see in the picture.
Eyespots and the flagellum
The eyespot is near the flagellum, so it can control how the flagellum moves.
Bibliography and further reading about eyespots: