You’re attracted to jerks because of the brain’s reward system. Your neural network is sensitive to rewards like affection and sex, but when these rewards come to you unexpectedly, they become much more alluring. It’s one of the reasons why people can’t stay away from an unpredictable partner who doesn’t treat them well. Source Source 2 Source 3