@created vs imposed isolation in schools
It's more or less both. A lot of times, people tend to be one of a few types of "loners": fedora-wearing "intellectuals" sneering at the peasants surrounding them, muttering to themselves how nobody can understand their art or whatever makes them special according to them. There's also the self-imposed isolation that comes with no sense of superiority in their reasoning, simply that they prefer to be by themselves. Finally, there is the "bullying" kind, which isn't self-imposed at all, and simply due to the way that their peers treat them. These are not, of course, mutually exclusive, and several factors can play important roles in a person's overall placing in the miniature society that is their particular school and their contentment with the fact.
People in the initial category, to me at least, seem to be attempting to fulfil the human need of wanting to be wanted - most people want to "mean something," particularly since the mortal existence is so terribly short in comparison to time itself, and many people, particularly when they are young and ambitious, want to be "famous". Carving out a notable niche is something that few humans ever end up doing, but there is often that ambition - that raison d'etre, that pushing force, that driving dream to be great - is something that persists in many humans, and is pretty much the sole reason why capitalism continues to somewhat work even today, despite the massive technological advances that have been created since its inception. People of the first category are more or less exhibiting this desire in a particularly annoying or obvious way. Special Snowflake Syndrome, indeed. This is just one reasoning, though, as there could be many reasons why this might possibly be.
The people in the secondary and tertiary categories are where "nerds" or "geeks" typically tend to be, from my personal experience. In this I refer to those who truly do care about their studies or their interest of choice, not people who "are into" such things simply for a few popularity points or a higher chance to get laid [as it is "cool" to be a nerd these days, thanks in part to The Big Bang Theory, I'd reckon]. People who tend to be "mad geniuses" are typically alone, either because they do not want to bother with involving other humans in their activities, or simply because they do not care. I personally differentiate this with the formermost matter with the strong air of superiority typically associated with peoples that happen to share the first mindset. Their peers might not notice or care for them, and if they do jeer, a person of the second "type" does not care or pays very little attention, as they are absorbed in their world.
People of the third type, however, are a different story. Humans dislike that which they do not understand, or that which is different; this has been consistently proven throughout history, due to the persecution of others based on what sets them apart rather than what binds them together, such as religion, sex, race, sexual orientation, language, and others. Ideologies and mannerisms are naturally a part of these differentiations, and being "strange" or "weird" tends to be a good ticket for being ostracised, particularly in more conservative societies. This makes sense on an evolutionary level; identifying with one with different mannerisms aside from the ones that had been proven to work could easily become disastrous or even fatal, and the species was meant to survive, not necessarily to adapt more than it needed to. As such, behaving in a way that is different or not considered normal or acceptable is an understandable reason for humans to reject other humans; this is particularly significant due to humans as a whole being of a social species, one that desires group acceptance and is gratified when this is received and generally stressed when it is not. Being rejected, particularly among ones' direct peers, can be very discouraging indeed.
Humans like having a group to belong to; this, again, has evolutionary uses, as strong loyalties to a certain group would result in a tightly-knit and stronger clan unit. This "hive" mentality is clearly not always good, however, as can be clearly shown in riots, particularly the Vancouver Riot of recent years. Perfectly normal people were doing destructive and violent things such as breaking into stores and destroying cars simply because of the rush of the crowd - they were not truly thinking, it was more or less their instinct taking over. A similar process is done for bullying; people like to unite against a common cause, even if that common cause is taking someone else down, bit by bit. Humans are very much blank canvases in the sense that they are capable of great acts of kindness, but also horrible acts of brutality - and not all brutality is physical.
So, while a lot of people truly are "the world is out to get me baww nobody understands me," don't handwave bullying and unwilling isolation - it does exist, and it does happen. Some people even do it subconsciously, with no active desire to cause emotional pain. It's pretty hard to avoid, too - when one would just handwave an action as nothing, another takes huge offence in the matter. I'd also like to briefly note that if you want attention, you kinda have to ask for it, you know? Most people aren't mind readers. If you want friends, you can't hope that they float to you, as that rarely works, and you'll find that you're much more likely to find trash than pearls on the beach; if you want something amazing, you're gonna have to dive for it.