A lot of people understand the concept in genetics that if a gene gives an individual more efficient access to resources through longer legs or stronger arms or more intelligent brains, than said individuals will have an easier time procreating and therefor their genes will spread and be selected (to use the often misinterpreted word).
But corollary to this concept is the idea that a gene doesn’t actually need to get you better access to resources. It can also be a gene for something that you think future potential mates of your children will find attractive. So if I like pink hair, but I know that everyone else likes brown hair, I’m incentivized to find a brown haired mate such that my children will have brown hair so that my children will have characteristics that others in the population find attractive.
This is hilarious because it can produce some very wacky things in nature. Think of all the birds of paradise that have the weirdest tales sticking out from their bodies. It doesn’t help them gather any type of food and makes them much easier to be caught by predators. But they have them only because the females are attracted to them ‘knowing’ that the rest of the female population is also attracted to them.