The Drow from Dungeons and Dragons are a race of elves with dark skin and pale hair that live mainly underground. How could these elves develop such a coloration when they live underground, away from sunlight, and by all means should be pale like many other creatures that live entirely in caves?
Underground there is more ambient hard radiation. Radon gas is a prime example and a major source for radiation exposure in subterranean spaces. The Drow use this radiation to supplement their metabolic activity in the same manner as radiotrophic fungi.
. Robertson et al. studied black yeast (Wangiella dermatitidis) subjected to low-dose ionizing radiation.  They wanted to deduce the impacts of chronic radiation on the melanin-containing yeast (recall that melanin is the pigment that results in human skin color), as well as melanin-lacking yeast. They discovered that radiation led to increased survivability in the melanin-containing fungi, as they were able to absorb more nutrients and export more toxic metabolites from their cellular systems. The scientists even found that fungi were able to safeguard their DNA and utilize ionizing radiation as energy for DNA repair in some extreme cases.  Dadachova et al. also noted that while melanin-lacking fungi grew better in non-irradiated environments, this observation quickly reversed in the presence of radiation, with melanin saturated fungi actually increasing rapidly in dry weight in the presence of continual radiation.
This growth can be at least partially explained by melanin's ability to catalyze an oxidative-reduction reaction typical of cell metabolism. According to Dadachova et al., the electron transfer properties of melanin in the NADH oxidation/reduction reaction sequence necessary to supply cellular energy increased 4-fold after prolonged exposure to radiation. Furthermore, even melanin-containing fungi cells subjected to limited nutrient conditions responded by growth when exposed to radiation as compared to their non-melanized cell counterparts.
Maybe the Drow use this for energy. Better would be for the melanin catalyzed oxidation /reduction to serve the same role UV light does on the surface - UV hitting the skin makes vitamin D for humans. In circumstances where UV light on the skin is scarce (people wear a lot of clothes, or days are short) humans evolved paler skin to maximize the ability to capture what UV there was.
Assuming human-type vitamin D metabolism in the Drow, they get essentially no UV light. They instead use melanin pigment (the only human pigment) to capture hard radiation to make vitamin D. The Drow are actually cave adapted albinos who secondarily acquired the ability to capture hard radiation energy via pigment, which is why they have white hair and pink eyes but skin that is nearly coal black.
Thinking more about what phenotype would result from this use of melanin, it would not look like humans exposed to UV. UV stops at skin, but hard radiation penetrates tissues. The drow would therefore have melanin through and through - not just on skin but also interior tissues and organs, blood, sclera and everywhere. Their sclera would be black and their blood would be black. This could happen if there were an organ that secreted melanin into the blood stream - occasionally this sort of global pigmentation can happen to people with widely metastatic melanoma - depicted.
Hair does not have a blood supply and so would stay white. Apparently irises are unaffected too so they would stay albino red.
The Drow were dark skinned before they migrated to the Underdark.
They migrated a long time ago by human standards - possibly enough time for humans to start speciation (we have only a vague idea how long it takes in humans), but elves reproduce very slowly. An elvish generation can be 40-500 years.
Add to that that their population is very small to begin with - The largest drow city has only 20,000 people. There might not be a million drow in the world. There is not a lot of opportunity for a mutant, pale skinned drow to be born. When a mutant drow is born, it is often killed at birth. For example, Drizzt was almost killed as a babe for having a different eye color.
Additionally, species tend to be much slower to lose traits with no benefit than they are to gain traits which provide one. For example, in giraffe necks, the nerves for their vocal cords travel down into their chest, around their heart and back up to their voice box. Why? Because it never stopped a giraffe from reproducing.
Intelligent species are even less likely to fail to reproduce due to some vestigial trait. Animals with culture and the ability to pass on knowledge are more likely to adapt their culture or their education than to adapt genetically.
The reason for having an advantage from Dark skin is that the pigment melanine blocks UV from the sun light. A possible explanation for drows' dark skin could be a natural source of UV radiation in the underground caves where they live as constant exposure would lead to fair skinned creatures dying of cancer most likely before reaching adulthood.
From this question/answer, we see that melanin can slightly protect against radiation - but only slightly.
So, if you lived somwhere surrounded by radioactive rocks - such as in underground caves - an extremely high level of melanin (leaving your skin nigh-on completely black rather than a deep brown) might provide just enough protection that you and your progeny do not suffer the DNA damage present in your paler bretheren, granting your descendants an evolutionary advantage.
We know very little of the Ilythiiri, or "Elves of the South," before this crucial event[the Descent]. Even then they were known as "Dark Elves" for the hue of their skins. They dwelt in the jungles and hot forests of the South. A proud, warlike, culturally advanced (some sages of other elven people say "decadent") folk, the Ilythiiri attacked all neighbors, including other elven tribes. Their cruel raids and depredations, ordered by warlike nobility and the clergy of their two cruel deities, Ghaunadaur and Lolth, forced elves, humans, dwarves and others to ally against them.
Considering the above, their skin color could have been an evolutionary defense against the harmful ultrawizard radiation.
Though I couldn't find a real-world equivalent for the things I'm going to list, a few possibilities come to mind:
I hope this helps!
In the forgotten realms (the main D&D universe), drows have for ancestors dark elves, who lived in the surface and had brown skin. However, it's clearly stated that drows have not only brown, but ebony-black skin. They also probably didn't have the distinctive white hair of the drows, but black one.
During the Descent, however, divine magic was used by the elves main god to turn them into drows.
Corellon Larethian’s magic, channeled through his clerics, turned all dark elves into drow. By that point some dark elves modified their bodies, and were thus not changed. The entire subrace of dark elves was turned into drow, including the survivors from Miyeritar. Elves believed it was done as collateral damage due to the elves not properly understanding elven high magic.
It's to note that drows, due to their link to their goddess Lolth, and possibly from demonic blood (see Wendonai), are inherently magical creatures, and have many innate magical abilities, as well as a strong resistance to magic.
So as disappointing as it is, at least in this D&D universe, the answer would probably be simply magic / divine curse.
A simple answer would be that elves use something other than melanin to protect themselves from sunlight. And something other than melanin to make their skin dark. So extrapolating from humans and other animals similar to humans is a mistake. In humans, dark skin is caused by melanin, which protects the skin from sunlight. In elves, dark skin is a natural color, as easily maintainable if not more than white skin.
Perhaps drow are albinos. It's just that in elves, the equivalent of albinos have dark skin.
Periods of Drow history were desperate and violent, with both civil warfare and outside invasion. Darker skin was selected for because it helps both a predator and prey to hide.