My hypothesis is that the scrotum, which in mammals, is often exposed, relatively hairless, and with thin skin and little subcutaneous tissue, may have evolved for perhaps a different reason than simply to provide a lower temperature for spermatogenesis.
Consider that humans produce about 25,000 sperm every minute. Why so many? All these sperm are engaged in a race to get to an ovum first, and it might be assumed that the point of having a race is so that the best quality sperm gets to fertilize the egg. But if all the sperm in the race had the same genome, what would be the point? The race only makes sense if there is variation in the genome, and the race is to select the most favourable mutation.
This suggests that there should be a lot of mutations among the sperm. And there are: double-headed sperm, sperm without a flagellum, etc.
What produces these mutations? One source of DNA mutations is radiation, including ultraviolet light (more specifically, UV-B radiation, with wavelengths from 280 to 315 nm, causes DNA damage). While most genetic mutations are harmful, a small number (probably very small) may lead to beneficial modifications to the phenotype in terms of the organism’s fitness or reproductive success. But without germ line mutations, evolution would grind to a halt.
To increase the rate of germ line mutations (as opposed to DNA mutations in somatic cells, which are very unlikely to be beneficial to the organism or to have an effect on offspring) one mechanism would be to increase the exposure of germ cells to UV-B radiation. My hypothesis is that the positioning of the testes in an exposed scrotum, together with the scrotum’s thin skin, relative lack of subcutaneous tissue, and relative lack of hair, provide for increased UV-B exposure of mammalian testes, and thereby stimulate germline mutations.