They are a fixture of every upbringing - the cliques that rule the school.

However, researchers have been baffled by the fact some schools have more cliques than others.

Now, they say the organisation of the school - even including the number of classes it offers, could explain it.

Scroll down for video

Mean Girls starring Lindsay Lohan (far left) made the school cliques famous. Now, researchers say they know why they form

WHAT THEY FOUND Schools that offer students more choice – more elective courses, more ways to complete requirements, a bigger range of potential friends, more freedom to select seats in a classroom – are more likely to be rank-ordered, cliquish and segregated by race, age, gender and social status. By contrast, pecking orders, cliques and self-segregation are less prevalent in schools and classrooms that limit social choices and prescribe formats of interaction. Advertisement

At almost any American high school, the elements of teen social networks are readily apparent: the cliques, the pecking orders and the varying degrees of self-segregation by race, age, gender and social status.

For years, sociologists have identified seemingly universal human instincts that spur this kind of sorting.

These include the desires for familiarity and certainty, for control and dominance, and for security and support.

But as ubiquitous as those instincts are, students in some schools form more cliquish, hierarchical and segregated social structures than in others.

The Stanford team say that the organizational setting of a school itself, its 'network ecology,' has a big impact.

Schools that offer students more choice – more elective courses, more ways to complete requirements, a bigger range of potential friends, more freedom to select seats in a classroom – are more likely to be rank-ordered, cliquish and segregated by race, age, gender and social status.

By contrast, pecking orders, cliques and self-segregation are less prevalent in schools and classrooms that limit social choices and prescribe formats of interaction.

Smaller schools inherently offer a smaller choice of potential friends, so the 'cost' of excluding people from a social group is higher.

In addition, structured classrooms guide student interactions in prescribed routes and encourage students to interact on the basis of schoolwork rather than on the basis of their external social lives.

Those are among the conclusions of a new study, published online today in American Sociological Review.

The lead author is Daniel A. McFarland, professor of education at Stanford Graduate School of Education.

'Educators often suspect that the social world of adolescents is beyond their reach and out of their control, but that's not really so,'' McFarland said.

'They have leverage, because the schools are indirectly shaping conditions in these societies.'

The study draws on an analysis of two datasets about friendships.

One considers friendships at the classroom level and the other at the school level.

At the classroom level, the researchers tapped into detailed data of friendships and social interactions compiled by McFarland at two very different high schools over a two-semester period.

The school-level data came from the National Longitudinal Study of Adolescent Health.

The researchers found that large schools tend to accentuate the quest by adolescents for friends who are similar to themselves, an instinct that sociologists call 'homophily.'

Bigger schools offer a broader range of potential friends, as well as greater exposure to people who are different.

The researchers found that large schools tend to accentuate the quest by adolescents for friends who are similar to themselves, an instinct that sociologists call 'homophily.'

It's a mixture of freedom and uncertainty that spurs students to cluster by race, gender, age and socioeconomic status.

But a school's size is only one factor.

The researchers also found that a school's openness to choice spurs cliques and social-status hierarchies as well.

In schools with a strong focus on academics, where teachers have a hand in setting the pace and controlling classroom interactions, teenagers are less likely to form friendships based on social attitudes imported from outside the school.

Instead, friendships are more likely to develop out of shared school activities and similar intellectual interests.

As the researchers put it, a positive educational climate strengthens the school's 'system membrane' and makes it more impervious to external criteria for friendship such as race or social status.

In other words, a more rigid school setting can sometimes promote more open-mindedness in making friends — a potentially valuable quality in adulthood.

McFarland cautioned that the study doesn't mean that students are necessarily better off in small schools with less choice.

For one thing, the practice of putting students on particular tracks based on their apparent academic prowess often has the side effect of segregating students according to race.