I'd wager it also has much to do with nerds not knowing how to be 'dumb', and thus, not being able to forge meaningful connections with people of lesser mental capacity.
Having interests and vocabularies that are alienating to people who struggle to keep up can often do just that.
> Nerds are unpopular in forced social settings like secondary schools because they're huge assholes, the kind of people that even 25 years later write essays about how really it was everybody else's fault that nobody got along with them.
Get over your grudges, seriously. I bet the people who used to make fun of you don't even remember why. They'll run into you someday in the grocery store and go "Hey man, what's up? How's life?" Now you can either make a new friend, or stay in middle school where you still get picked on for your terrible social skills.
The other issue, at least at my school, was there were at least as many smart, non-nerd people as nerds. And nerds could be real fools. But nerds definitely have a habit of overestimating how smart they are compared to other people.
Having interests and vocabularies that are alienating to people who struggle to keep up can often do just that.