You're attracted to jerks because of the brain's reward system. Your neural network is very sensitive to rewards like affection and sex,
but when these rewards are unexpected, they
are much more alluring. It's one of the reasons why people keep going back to unpredictable partners that don't treat them well.