This story is part of BBC Earth's "Best of 2016" list, our greatest hits of the year. Browse the full list.

My reverie as I walk through Costa Rica's beautiful Corcovado National Park is brought to a sudden halt when the guide's arm slams into my chest. "Stop!" he shouts, pointing at something thrashing around in the sand. "Sea snake."

As I watch the yellow-bellied sea snake, out of its element and seemingly distressed, a piece of trivia from my childhood surfaces in my brain.

"Sea snakes," my younger self reminds me, "are the most dangerous snakes of them all. You should be careful."

This "fact" is actually an exaggeration, but it is true that some sea snakes are incredibly venomous. So are certain land snakes: a single bite from an inland taipan contains enough venom to kill 250,000 mice, for instance. And it is not just snakes that hold this sort of power. One drop of marbled cone shell venom can kill 20 humans. A box jellyfish sting can cause cardiac arrest and death in a matter of minutes.

This begs the question: why possess a weapon powerful enough to kill dozens if you are only ever going to use it in a one-on-one situation, and specifically if you have no intention of hunting anything the size of a human?

It is reminiscent of the commonly held myth (and it is a myth) about daddy longlegs; namely, that they possess the most powerful venom known to man, but evolved it for nothing because they lack the means to administer it. The most powerful venoms just seem to make no evolutionary sense.

The reason for an animal possessing toxic weaponry is simple enough. Venom is a means by which to subdue prey without risking your own neck in the struggle. Secondarily, it is also a useful defensive strategy.

What is strange, however, is the level of venomous excess found in nature. Why does a snake possess the capability to kill hundreds of thousands of mice with each bite? This is especially odd when you consider what an expensive weapon venom is.

A single bite from a taipan snake contains enough venom to kill 250,000 mice

Venom tends to contain mixtures of protein-based toxins, often acting synergistically to wreak havoc on internal organs. A snake haemotoxic venom might contain one component that prevents blood from clotting, and another that breaks down the walls of blood vessels. The results are predictably messy.

Protein synthesis requires a substantial energy investment, but this has not stopped the evolution of venoms containing thousands of peptides and proteins, at considerable cost to the animals in question.

And to some extent, venomous animals actually account for these costs. It is difficult to test such things directly, but it appears that snakes adjust the amount of venom they inject depending on the size of their prey, so as not to waste it.

Furthermore, one experiment conducted with pit vipers demonstrated an 11% increase in metabolic activity following venom extraction, indicating a link between physical exertion and venom production.

Even so, the classical view of natural selection would see such costly traits stripped away unless they are absolutely necessary. This has indeed happened in some species: the marbled sea snake, which has reverted to eating eggs, consequently lost its ability to produce venom.

The fact remains, however, that there are plenty of animals going around with costly cocktails of chemicals in their fangs, barbs and spines that appear to be vastly more potent than they need to be. Why?

Venom has to be 100% efficient and cause death very rapidly

One traditional view holds that heightened toxicity is the result of evolution compensating for shortcomings in other areas.

As any desert dweller will tell you, when it comes to scorpions, it is not the big and scary-looking ones you need to watch out for, but smaller species such as the evocatively named deathstalker – generally considered the most dangerous scorpion in the world.

"Box jellyfish are another good example," says Yehu Moran, a researcher at the Hebrew University of Jerusalem, who together with his colleague Kartik Sunagar has recently undertaken an analysis of how natural selection acts on toxins in venomous animal lineages.

"They are very fragile, and something as muscular as a fish could cause them to rupture from the inside when they try to eat it. So venom has to be 100% efficient and cause death very rapidly."

If a predator is small, weak or slow, it is vital that its venom is capable of incapacitating almost instantly to avoid prey escaping or struggling. In such cases, it is easy to see how high toxicity might be selected for.

Economics play a part too. The inland taipan inhabits the arid heart of Australia, where it is crucial that venom brings about certain and immediate death. In the desert, every meal counts, so the snake cannot afford to let one escape.

Even so, being able to kill 250,000 mice with a single bite seems a bit unnecessary. Asked to account for the number of mouse fatalities that can result from a single taipan bite, Wolfgang Wuster – a snake venom expert from Bangor University, UK – has a simple answer.

Most venomous animals target a specific and narrow array of prey species, and it is these species that shape the evolution of their venom

"It's because they don't eat lab mice," he says. "Looking at the lethality of venom to those mice is completely irrelevant to what the snake does in the wild."

While the LD50 test (lethal dose 50% – the amount required to kill half of a test group) using mice is the primary means by which to assess venom toxicity, it is flawed.

"The mouse model enables standard data to be acquired," says Robert Harrison, head of the Alistair Reid Venom Research Unit at the Liverpool School of Tropical Medicine, UK. "But mammals are not always the diet of preference, so toxicity in mammals is simply a standardised metric that probably has no bearing on toxicity to an amphibian, arthropod or bird."

Most venomous animals target a specific and narrow array of prey species, and it is these species that shape the evolution of their venom.

What results is a co-evolutionary arms race. The prey species evolves resistance to venom, only to then be faced with a more potent venom further down the line.

I would put a fair bit of money on there being one tough mother of a rat in Australia that can survive taipan venom

Marvelling at how many mice could be killed by a single snakebite makes about as much sense as being surprised that a cheetah can easily outpace a tortoise. The cheetah simply did not evolve to hunt tortoises, and consequently the tortoise did not evolve to escape cheetahs.

"There's no such thing as absolute toxicity," says Wuster. "If you want to know how toxic something is, the first thing I'm going to ask is: 'what do you want to kill?'"

Of course it is not for nothing that venoms are tested on mice. "The assay was primarily designed to establish toxicity in mammals – i.e. to us – in order to inform antivenom design," explains Harrison.

But not all mammals are so susceptible to venom. Mongooses, ground squirrels and even hedgehogs are all capable of surviving the bites of certain snakes; bites that could easily kill humans.

"There's a species of mouse in Israel that weighs 20g and can survive a bite from a saw-scaled viper that would have you or me bleeding from every orifice and in intensive care," Wuster continues. "I would put a fair bit of money on there being one tough mother of a rat in Australia that can survive taipan venom."

If you want to know how toxic something is, the first thing I'm going to ask is: 'what do you want to kill?'

This super-mouse has probably evolved its resistance to the viper bite because it is a key component of the snake's diet. Paradoxically, some animals are particularly vulnerable to toxins precisely because they are specifically targeted by venomous animals.

Saw-scaled vipers that feed primarily on scorpions, for example, possess special venoms with a heightened toxicity for scorpions. A similar phenomenon has been observed in coral snakes, which possess targeted venoms that are more toxic for their preferred prey species – be that fish, rodents or other snakes.

In these instances, it is likely that the prey species in question are not under pressure to evolve ways to survive the venom, because in their habitat venomous snakes are relatively uncommon. If they are facing attacks from a variety of predators, of which snakes only constitute a small proportion, there will be less pressure on them to evolve such predator-specific defences – potentially at high energetic cost.

No venomous species have evolved specifically to hunt humans

The production of multiple toxins ties into the evolution of venom too – at least, to begin with. The more different components incorporated into the venom, the less likely a prey species will acquire immunity to each one. Therefore, complex venoms might be favoured by natural selection.

In their recent paper, Sunager and Moran found this is, indeed, the case in animal groups – like the snakes and cone snails – that have become venomous relatively recently in the evolutionary past.

Some venomous animals, such as jellyfish, spiders and centipedes, with a much more ancient history of being venomous produce fewer different types of toxin though. It seems they have passed through a second stage of evolution, where negative or "purifying" selection removes most of the elements in the venomous toxin and focuses on preserving a small handful of highly potent toxins.

Fortunately, no venomous species have evolved specifically to hunt humans, and yet there are thousands of documented cases of human deaths following unfortunate encounters with snakes, jellyfish, scorpions and other venomous critters.

There's a species of mouse in Israel that weighs 20g and can survive a bite from a saw-scaled viper

"Primates just don't seem to be prone to developing venom resistance," explains Wuster. So chances are something that has evolved potent venom to take down highly resistant targets will possess more than enough firepower to kill a human.

Bad luck comes into it as well. A bite from a Sydney funnel-web spider is extremely dangerous for humans, whereas rodents are relatively unaffected by their venom. Since these spiders evolved to eat neither rodents nor humans, this can be seen as nothing more than an unfortunate alignment of the spider's neurotoxin with a receptor on some of our cells.

It is of course important to study how venoms affect human physiology. Such studies have allowed us to develop antivenoms, as well as other drugs such as the blood pressure medication captopril, which is based on pit viper toxins.

To really understand them, however, we need to expand our horizons beyond humans and investigate how venoms are used in nature.

What should be clear is that toxins, like a lot of useful traits in the animal kingdom, come with a price.

Its small jaws and insufficient fangs mean it rarely bites anything much larger than a fish

Snakes, jellyfish and cone snails did not evolve powerfully potent venoms just for the sake of it. Their venoms are specialised, and capable of doing exactly the job they are meant for – even if that job is not immediately obvious to us.

Back in Costa Rica, our guide manoeuvres the sea snake back into the water, gripped between two sticks, so as to prevent any less wary passers-by treading on it. I am satisfied that I have just avoided a grisly death as we continue with our walk.

Later I find out that I need not have worried. It turns out that our sea snake does not rank high on the list of venomous animals. What's more, even though its venom is certainly powerful enough to kill a human, its small jaws and insufficient fangs mean it rarely bites anything much larger than a fish.

And that is just fine as far as the sea snake is concerned. Fish are a natural part of its diet, and humans are not.