If you remember high school as an occasionally awkward series of confrontations between tribes of similar-grouping kids, this is a good sign that you...went to high school. Most high schools segregate by "type," whether it's age, class, ethnic background, or volume of face makeup. Some schools are ruled by cliques that are as hardened as castes. Others don't have the same razor-sharp divisions between nerds, goths, lax bros, and queen bees.

What's behind the difference between schools, if the instinct to be around similar people is universal? McFarland says it's not about the students. It's about the schools, themselves. The way high schools are designed—their size, their level of diversity, and the way they treat students—can either drive students to segregate based on things like household income and race, or force them to build relationships that are more about their high school life than their socioeconomic backgrounds.

In bigger high schools, students are exposed to a greater diversity of students, which might make you think they’d be more likely to form friendships across socioeconomic barriers. Instead, McFarland found that in these schools, students are more anxious about finding meaningful relationships, and they respond by seeking out familiar peers who offer security, support, and protection.

"Larger schools that offer more choice and variety are the most likely to form hierarchies and cliques and self-segregation,” said McFarland, a professor of education at Stanford Graduate School of Education. "In smaller schools, and in smaller classrooms, you force people to interact, and they are less hierarchical, less cliquish, and less self-segregated.”

McFarland and other researchers asked students to name their closest friends. Next, they studied the direction of these friendships to identify cliques (many people citing each other) and popularity rankings. Students were considered popular not only when lots of people pointed to them, but also when lots of people pointed to people who point to them. "That suggests a pecking order,” McFarland said.

School size wasn’t the only factor that affected cliques and hierarchies. Schools that grouped students by academics and created other ways to force kids with different backgrounds to cooperate (whether in clubs or on sports teams) were less ruled by segregation and hierarchy. "In classrooms with assigned seating, you’re forced to sit next to someone whom you wouldn’t otherwise interact, and that tends to break down the tendency to segregate by background,” McFarland said.

McFarland says his work could easily be misinterpreted as a criticism of big high schools and cliques. He told me assertively that he's not prepared to make a blanket statement about the ideal size of a school or classroom in America. "We don't know what size school is best for social development," he said. "I did okay in a big, homogeneous public high school in Kansas. A shy kid might do better in a small school in New York.” There are silver linings to cliques, as well, he acknowledged. “They can be supportive and protective," he said. "They can also be vicious. We all agree that if people sort on the basis of class or race, that’s not a good thing for a pluralist democracy."