There are many things I consider beautiful. I like a colourful dance, a haunting song or an intriguing face. But I couldn't always consciously tell you why.

Peacock spiders are much the same. The males have beautiful rainbow-coloured abdomens, which they show off by performing some serious dance moves. They go to all this trouble to win the approval of a female.

The peacock spider and I are far from alone. When it comes to choosing a mate, many animals seem to have a clear sense of what is beautiful.

These preferences may seem arbitrary. It's hard to see how it would benefit a female peacock spider to choose a colourful male who can dance. But in fact these preferences may have had a profound effect on the course of evolution.

The idea that animals have "beautiful" traits to attract mates was first put forward by Charles Darwin. He proposed that one sex, often males, competes for the attention of the other.

The unsuccessful suitor ends up with fewer offspring

Darwin called this "sexual selection". He wrote that it "depends on the advantage which certain individuals have over other individuals of the same sex and species, in exclusive relation to reproduction."

This competition is not to the death. Instead the unsuccessful suitor ends up with fewer offspring. What's more, mate choice is crucial to the theory. The sex that's being courted, often the female, will prefer a mate with the most desirable traits.

This is quite different to natural selection, otherwise known as survival of the fittest. Animals with poor-quality genes, for instance that make them more prone to disease, tend to die young, so only the best genes are passed on to future generations.

Sexual selection and natural selection push animals to evolve in different ways, in a sort of tug-of-war. In particular, Darwin set out many examples of extreme and beautiful traits that evolved by sexual selection: the beautiful plumes of birds of paradise, the large antlers of stags, the striking colours of some insects, and birdsong.

It is impossible to doubt that she admires the beauty of her male partner

These traits can be detrimental at times. For example, a long colourful plume may attract more predators. But the ability to attract the best possible mate and produce lots of healthy offspring will more than compensate.

As Darwin noticed, these traits are beautiful. Discussing birds with elaborate, graceful plumes, he wrote that "it is impossible to doubt that she admires the beauty of her male partner… The sweet strains poured forth by many male birds during the season of love, are certainly admired by the females."

However, at the time people did not take to Darwin's views.

The idea that animals have some sense of beauty did not fit with Victorian society's hierarchical attitudes. People thought that the higher classes were superior to all other living things, says Marlene Zuk of the University of Minnesota in Saint Paul.

Darwin had not explained how mating preferences arose in the first place

"The Victorian scientists thought you had to be among the higher social classes to have an appreciation of the finer things in life, like art and music," says Zuk. "If the working class British couldn't, why would they imagine that animals could have an appreciation for beauty?"

Even Alfred Russell Wallace, who co-discovered the theory of natural selection, did not believe that female choice was important.

More problematically, Darwin had not explained how mating preferences arose in the first place, says Adam Jones of Texas A&M University in College Station. "You can't take it for granted that organisms had a sense of aesthetic beauty and that it drove the whole sexual selection process. Scientists had to explain why they had that sense, why do they care about beauty."

The key idea was presented in the 1970s, by the biologist Robert Trivers. He realised it was all about how much effort animals put into parenting.

If one parent has to put a lot of time and effort into rearing their young, they are likely to be much fussier about picking the right partner, compared to parents whose offspring need little attention. This investment "governs the operation of sexual selection", according to Trivers.

Females prefer the males with the most eyespots on their tail

He argued that animals would be more likely to have strong preferences for beautiful partners if they have to invest a lot in their offspring. In line with this, many such beautiful ornaments are also indicators of the fittest mate.

The elaborate tail of a peacock is perhaps the most well-known example. The bigger a male's tail, the harder it is to escape predators.

Yet females prefer the males with the most eyespots on their tail, and with good reason. A study published in 1994 showed that peacocks with bigger plumes have healthier offspring. That means the large tails, and females' preference for them, are both favoured by evolution.

A peacock's tail acts as an honest signal of his genetic superiority. It takes lots of energy to grow an elaborate tail, and to carry it around, so only the fittest can afford to do so. This is called the handicap principle.

Many other male birds signal their fitness in a similar way. For instance, male ribbon-tailed astrapias have tails that are 3ft long, the longest tail of any bird compared to the size of the main body. Its size is entirely driven by female preference.

Crucially, the female's decisions don't have to be conscious ones, says Jones. Critics of sexual selection, like Wallace, didn't like the idea that the animals were making a choice. But Jones says an attraction to something beautiful can simply be a physiological response.

For example, female olive fruit flies prefer males that vibrate their wings quickly. That is sexual selection, but we don't automatically assume that it involves a conscious choice. It could be automatic.

The response to beauty may be similarly instinctive. That's certainly the human experience.

Humans are a bit different because, unlike many species, both sexes get to be choosy.

For example, males prefer females with ideal waist-to-hip ratios, while females prefer deeper voices and squarer jaws. Like the peacock's tail, these traits are honest markers of health and resistance to parasites, and are hard to fake.

Did our ape-like ancestors have similar preferences for beautiful partners?

They also signal how fertile we are. Attractive traits in males are indicators of higher testosterone, and attractive traits in females signal higher oestrogen. Both of these hormones are linked to fertility.

Both sexes are usually heavily involved in parental care, so it makes sense that both have evolved to be beautiful.

Did our ape-like ancestors have similar preferences for beautiful partners, favouring blemish-free, symmetrical faces with prominent cheekbones? We can't study their mate choices, because they're all extinct. But we can look at other primates, and the evidence looks promising.

A 2006 study showed that rhesus macaques also use symmetrical faces as indicators of high-quality mates, just like humans. Similarly, female orang-utans prefer males with large cheek pads called flanges. This suggests that humans and our relatives have been using our faces to advertise our genetic quality for a long time.

Our sense of beauty is not just an aesthetic whim

It's natural to prefer young, healthy mates with no sign of disease, says Glenn Sheyd of Nova Southeastern University in Fort Lauderdale, Florida. This combination "activates the desire to mate preferentially with one individual over another", says Sheyd.

These studies tell us something profound about ourselves. Our sense of beauty is not just an aesthetic whim, but is vital to our own survival. "The bottom line is, if there are some individuals which aren't as good as picking out fertile genes, they will be selected out," says Sheyd.

That raises a new question: how do our specific preferences evolve? A study of small birds called zebra finches offers a clue.

The 1982 discovery by Nancy Burley, now at the University of California, Irvine, began with an accident. Whenever Burley's lab received new zebra finches, she would fit them with small coloured bands to help keep track of which was which.

The zebra finches had evolved a new set of sexual ornaments in the lab

To her surprise, Burley found that birds wearing certain colours were more successful at finding mates, and even put more effort into parenting their offspring. Females preferred red-banded males, while males preferred black- and pink-banded females.

In effect, the zebra finches had evolved a new set of sexual ornaments in the lab, fast enough for Burley to watch it happening.

It seems zebra finches are naturally inclined to value certain signals. This seems peculiar, because unlike the signals encoded in a peacock's tail, the coloured bands were essentially meaningless.

Burley's work implies that there is something almost random about the traits that animals evolve to find beautiful. Before her findings, it had been suggested that these traits began as something with a function, and then got exaggerated.

For instance, you might imagine that peacocks first evolved large tails to help stabilise themselves in flight, and that the tails then got bigger and bigger under the influence of females. But it could be that peahens simply liked big tails.

Like humans, Burley's zebra finches could be made to look more beautiful to their mates by manipulating their appearances. According to Burley, that suggests there are preferences for certain traits or colours hard-wired into their brains.

In the future, random changes in zebra finches' DNA could well produce new beautiful traits like colourful feathers, which mates will then favour. Burley says the finches have "latent biases that predispose them to novel mutations when they pop up". The ornaments zebra finches currently rely on could well get replaced. "Evolution isn't over," says Burley.

Without this innate response to beauty, and the resulting competition for mates, life might look very different.

Take common fruit flies, which are normally rather promiscuous. A 2001 study found that when males are forced to be monogamous they evolve smaller bodies and produce less sperm. Similarly, when females are genetically modified to be monogamous they become less fertile. The implication is that, if there was no sexual selection, sex might have stopped altogether.

While most of us won't get to see a peacock spider dancing or a bird of paradise performing, we are still surrounded by beautiful animals that have been partly shaped by sexual selection. Much of the diversity and glory of life is down to animals' appreciation for beauty.

"If you have to compete for mates, and you have to be beautiful to do that, then competition is going to add an extra dimension to the evolution of that organism," says Jones.

In a way, it doesn't matter if I don't think too deeply about why I find certain landscapes or people beautiful. The important thing is that I have the preferences at all, because without them, our evolutionary history would have been very different.