Wish fulfillment.

For guys, it's simple. If nerdy guys got the girl with any regularity, this thread wouldn't exist. You sell a lot more tickets to them with a fantasy than you do with the reality they're already used to.

For girls, it's a bit more subtle. There's a vast gulf between what you think you'd like out of a relationship and what you actually go for. Notice guys complaining that they only meet crazy chicks, and girls complaining that they only meet jerks. When they sit down and think about it, the idea of a nice, normal, stable guy appeals to them. It's just that practice diverges pretty far from theory.