Those in our evolutionary past who failed to mate successfully failed to become our ancestors. All of us descend from a long and unbroken line of ancestors who competed successfully for desirable mates, attracted mates who were reproductively valuable, retained mates long enough to reproduce, fended off interested rivals, and solved the problems that could have impeded reproductive success. We carry in us the sexual legacy of those success stories.
Evolutionary psychologists study what people do to make themselves more "valuable" as mates, how they derogate same-sex rivals, and also behaviors that promote pair-bonding - among many, many other things. It's a sexy field to say the least, and is not without flaws.
Anyone who wants a highly accessible crash course in the sexier parts of the field should start with The Evolution of Desire.