Spiders have primarily four pairs of eyes on the top-front area of the cephalothorax, arranged in patterns that vary from one family to another. The principal pair at the front are of the type called pigment-cup ocelli ("little eyes"), which in most arthropods are only capable of detecting the direction from which light is coming, using the shadow cast by the walls of the cup. However, in spiders these eyes are capable of forming images. The other pairs, called secondary eyes, are thought to be derived from the compound eyes of the ancestral chelicerates, but no longer have the separate facets typical of compound eyes. Unlike the principal eyes, in many spiders these secondary eyes detect light reflected from a reflective tapetum lucidum, and wolf spiders can be spotted by torchlight reflected from the tapeta. On the other hand, the secondary eyes of jumping spiders have no tapeta.
Other differences between the principal and secondary eyes are that the latter have rhabdomeres that point away from incoming light, just like in vertebrates, while the arrangement is the opposite in the former. The principal eyes are also the only ones with eye muscles, allowing them to move the retina. Having no muscles, the secondary eyes are immobile.
The visual acuity of some jumping spiders exceeds by a factor of ten that of dragonflies, which have by far the best vision among insects. This acuity is achieved by a telephotographic series of lenses, a four-layer retina, and the ability to swivel the eyes and integrate images from different stages in the scan. The downside is that the scanning and integrating processes are relatively slow.
There are spiders with a reduced number of eyes, the most common having six eyes (example, Periegops suterii) with a pair of eyes absent on the anterior median line. Other species have four eyes and members of the Caponiidae family can have as few as two. Cave dwelling species have no eyes, or possess vestigial eyes incapable of sight.
Read more, here.