First, some basics: Vision depends on light, which comes in a spectrum of wavelengths, ranging from very long to very short. Vertebrate eyes have two kinds of light receptors in the retina at the back of the eye: Rods, which are sensitive at low light levels, and cones, which are stimulated at higher light levels and function in color vision.
Humans (and a few other mammals) have three types of cones; each type is receptive to a different range of wavelengths with peak sensitivity in the middle of the range. One type of cone deals with long wavelengths toward the red end of (what we call) the visible spectrum; other cones are sensitive to medium-long wavelengths in the middle part of the spectrum. The third type of cone is sensitive to short wavelengths, in the blue-violet end of the spectrum. Still shorter wavelengths, outside of the normal human visible spectrum, we call ultraviolet (UV). Humans and some other mammals have cones that are slightly sensitive to UV light, but the lenses filter it out.
However, lots of birds, fish, and reptiles have a fourth kind of cone that is UV-sensitive. Even a few mammals (e.g., some rodents and bats) can see UV light quite well. Furthermore, some mammals have lenses that don’t filter UV wavelengths, so they can use UV to some extent– examples include hedgehogs, dogs, cats, and ferrets, among others. Day-hunting snakes have lenses that block UV wavelengths, but night-hunting snakes have lenses that transmit UV. For these animals, just little extra light might enhance vision in some conditions.
I’d love to be able to present a survey of all the vertebrates, not only about who has UV vision, but also to find possible correlations of UV sensitivity with the ecology, behavior, and evolutionary history of the species. But such a systematic survey does not exist. Part of the problem lies in the complexity of what determines the sensitivity; several factors are involved. The animal must possess the visual receptor cells (typically cones). Those cones must also be functional; that is, they must not be turned off by genetic mutations. And the UV wavelength must actually reach the retina, not filtered out by lens, cornea, or other structures. Apparently only seldom have enough of those features been measured in enough animals allow a wide search for correlations with ecology, behavior, and evolutionary history.
There is still a further question: if an animal can see UV, how is it useful to the animal? This is often difficult to determine, and suggestions outnumber the answers. Here are a few bits and pieces:
UV sensitivity may be useful in foraging: Several studies have suggested that birds of prey that hunt small mammals may key in on trails left by the mammals as they scent-mark with reflective urine, although another study showed that vole urine is not very reflective in the UV range. It is possible that UV-sensitivity helps locate ripe fruits or insect prey because the UV reflectance of fruit and some insects differs from that of background leaves. But how often this works in the natural world is uncertain. Hummingbirds can see in the UV range. Many flowers either reflect or absorb UV, and hummers may use that ability to discriminate among flowers that they might visit and pollinate.
Among bats, a mutation causing loss of functional short-wave light sensitivity is found in nocturnal species that commonly roost in caves and echo-locate, using sonar to navigate and capture prey. Researchers suggest that perhaps using sonar pre-empts brain space otherwise used for UV perception. However, the correlation is not so clear, because the loss also occurs in fruit bats, which roost in trees and do not echolocate.
Decent data are more available for the use of UV reflectance and sensitivity in social situations in birds, fishes, and reptiles with good color vision. For example, male mountain bluebirds have more UV-reflective plumage than females, and males that reflect more UV are more successful in mating and siring offspring. Similarly, female sticklebacks and guppies perceive UV and prefer to associate with males that have good UV reflectance. Another study showed that lizards living in light, UV-rich habitats have social displays that convey signals in the UV range, while those in dark habitats do not.
I’ve left mention of amphibians to the end, because that story gets more complicated. It seems that many amphibians can see color in the dark. They have two kinds of rods (sensitive at low light levels) in addition to cones; some of those rods are UV sensitive. Could that be true of some other vertebrates too?
This leaves UV vision in insects and spiders and other invertebrates for another story (maybe).