Put bluntly, because human beings aren't rational only possessing logic as a secondary faculty for problem solving. A rational creature couldn't have survived as long as we have in this chaotic and dangerous world. No only something wild, impulsive, aggressive, emotional, and irrational can exist under the demands of nature and not go extinct.
Well, part of the reason is because attraction and desire are related cognitive entities that are both connected to the perceived value something has. Things that are rare, scarce, and difficult to acquire that are rewarding are deemed as more valuable to our psychology. This doesn't change in the arena of sexual attraction. Social status, physical attractiveness, social class, and availability all influence how valuable/desirable we perceive a person to be, thus our brain is searching for mates we deem as valuable and valuable is translated into perceived attractiveness. Now when it comes to personal factors of attraction attachment styles, personality traits, genetic similarity, our levels of physical attractiveness, and our beliefs about ourselves all influence who we're attracted to and all of this is there to make sure we pick a viable and valuable mate, but why do humans pick mates? To have babies, so nature didn't build into our brain a switch for having a partner for more than 2 to 3 years, because that's about as long as it takes to raise an infant to an age where they can walk and detect threat, so what makes sense to us in terms of what we're attracted to has nothing to do with our long-term happiness and wellbeing but making sexy and healthy babies. Thus, heartache and confusion everywhere, but there is hope. Picking a person to be with is like deciding what you should eat, where you should live, and what you should do with your life. Establishing a diet is about eating food that is desirable and healthy. Deciding where to live is imagining if you would be happy living in a place for a few years based on the opportunities, amenities, and downsides of the place. Deciding what you should do with your life is finding something to do that you value so much that you can overlook the bullshit that comes with it with enough vacation time. Apply these lenses to a person you're attracted to and you're more likely to get someone who is good for you long term is my hypothesis and currently the model I'm working with. Happy hunting.