Why nerds are unpopular

But I think the main reason other kids persecute nerds is that it’s part of the mechanism of popularity. Popularity is only partially about individual attractiveness. It’s much more about alliances. To become more popular, you need to be constantly doing things that bring you close to other popular people, and nothing brings people closer than a common enemy.
Like a politician who wants to distract voters from bad times at home, you can create an enemy if there isn’t a real one.
By singling out and persecuting a nerd, a group of kids from higher in the hierarchy create bonds between themselves. Attacking an outsider makes them all insiders. This is why the worst cases of bullying happen with groups. Ask any nerd: you get much worse treatment from a group of kids than from any individual bully, however sadistic.

Paul Graham