Aposematism is a strategy used by some animals to alert others to their presence and promote avoidance. This usually is in the context of warning coloration, but the warning signal can also take the form of a shape, call, or smell. Some examples of animals that display aposematism include wasps, certain dragonflies, tiger moth, black widow spider, coral snake, cobras, ladybugs, cuttlefish, the poison dart frog, and other assorted insects, reptiles, amphibians, and birds. Even some plants, like foxgloves, employ aposematism.
Aposematism is diametrically opposed to another common evolutionary strategy, crypsis. Crypsis consists of an animal concealing itself, while aposematism is the opposite -- attracting attention to itself. But the animal usually only attracts attention to itself because it has something to back itself up -- usually venom, but sometimes a foul taste or poisonous flesh. Being wary, predators and other animals avoid the warning. An avoidance of animals with bright colors is probably partially built into our minds from birth, due to evolutionary psychology.
Although it takes significant metabolic resources to evolve and maintain systems for self-defense, many animals have done it. Once such a system is evolved, aposematism is one of several possible directions for the species to travel in. Although many wasps are brightly colored, there are some that are not. In addition, some animals, like common ants, are considered aggressive and contain little nutrition, meaning only specialized predators eat them, but many species lack warning coloration. So the presence of defensive strategies makes aposematism more likely, but not guarantee it.
We have good reason to be afraid of certain brightly colored animals. Some, like wasps, give a painful sting that can be repeated again and again. What's worse, wasps release special enzymes that attract other wasps to keep stinging. One wasp found in Japan, the Japanese giant hornet, has a sting so powerful than it has been compared to having a red hot nail hammered into your arm, and it can kill. Another aposematic species, the Golden Poison Frog, is one of the most poisonous animals on the planet. Its poison is so lethal that a single 2 in (5 cm) individual contains enough poison to kill 10,000 mice, 20 humans, or two elephants.
Some animals evolve bright colorations through mimicry -- though lacking defenses themselves, they want to appear to predators as though they were somehow dangerous. This is called Batesian mimicry, and there are countless examples.