Under certain conditions, idealism will win out in competition with selfishness. Here, by idealism, I mean the desire to behave so as to cause the species to evolve in a certain way, the ideal way. Suppose, first, that idealists of the species are sufficiently wise to determine how to behave so as to further the ideal. Second, suppose that they are sufficiently sensitive to determine which animals in their species are like-minded idealists. Then animals who share the ideal will behave unselfishly toward each other, and so will likely succeed better than selfish animals.
The first requirement is more than might be supposed. Presumably the reason the peacock loves fancy tail feathers is that the fancy feathers are not very abstract and are located near the mating area, so it is not very taxing of the abstract thinking powers of peacocks to realize that a very good way to love tail feathers is to encourage mating with those birds who possess fancy tail-feathers or with those who unselfishly love fancy fail-feathers.
The second requirement, on the other hand, is less than what is appreciated. There is no occasion to evoke game theory or some such thing to understand how sensitivity toward likely deception arises notwithstanding there is a marked advantage selfishly to being selfish while pretending to unselfishness in order to obtain unselfish love. The key is that most unselfish rewards must be given through mating, say by caring for a mate more than is selfish or by being more willing to have children without expectations of caring than is selfish. To the extent unselfish rewards give more mutual children than otherwise, a selfish individual who pretends to idealism may get more offspring, but it can only get more offspring from an individual who is easily deceived. Thus, what a non-idealist can practically never get by being selfishly deceptive is offspring that are not easily deceived. Therefore, since animals tend to inherit traits from ancestors, an animal can tell fairly easily whether another animal is likely deceptive as to his idealism, merely by judging whether the other's behavior reflects an understanding of its own ideals. It is easy to judge oneself, and thus easy to judge whether another understands it. Sensitivity will be positively correlated with idealism, and the former being easy to judge will help make the latter fairly easy to judge also.
Of course, there can be competition not only between selfish individuals and idealists, but also between idealists holding different ideals. So there is a competition between ideals. In advanced animals capable of handling abstraction, a reasonable assumption is that the ideal that most causes love of traits useful in natural selection would prosper most. Indeed, as mentioned, it is best to unselfishly reward via mating, which would cause idealists to have an increased tendency to mate with those who possess the traits they love; and of course, it is useful to an animal to want to mate with animals who are talented. It follows that the most prosperous idealists (let's call them altruists) likely would find beautiful in others a certain combination of talent, unselfish love of talent, unselfish love of unselfish love of talent, etc., namely the combination that is most likely to lead to a successful ideal, and would basically behave as if trying to make the world more full of this beauty. Oftentimes one hears people say that good individuals are one's who try to make the world a more beautiful place in the long run, so the results seem reasonable empirically.
It is important to note that those who merely love talent in others will likely lose out in competition with those who also love unselfish goodness in others. Indeed, there is little reason to suppose that merely being of the sort to love talent unselfishly is going to make one be loved unselfishly, since individuals who share the ideal won't love unselfishly on account of love of talent, because all they love is talent. As seems morally obvious, beauty is not just talent but goodness also.
Of course, there also is probably something akin to an idealism selection that occurs between different species, and yet still other things might be involved, so this description of beauty and altruism should be taken as a vague approximation that doubtless can't equal the intuitive notions that drive moral people. But a good way to improve our moral intuition (certainly a good thing to do) is to develop a better rational understanding of morality, which can presumably be done by creating models the best we can that approximate this intuitive understanding, and so building these models doubtless serves a useful moral purpose so long as we don't take them too seriously. A danger, I should point out, that is no more than the danger of taking emotional-based expressions of moral sentiment too seriously (witness the possible effects of martial pageantry and parades). And idealism selection seems to be a much more intuitively appealing way of explaining morality than assuming morality is an outgrowth of kin selection or group selection, as seems to be the approach most typically used; the latter phenomena to my mind might explain family togetherness and patriotism to a reasonable approximation, but we can simply do much better in understanding morality.