Have you ever heard the phrase “birds of a feather flock together"? If you've ever watched birds in nature, you know that this phrase holds true. If you see a flock of birds flying together, it's made up of the same kind of birds.
For example, you might see a group of sparrows flying together. You usually won't see a sparrow, a seagull, a buzzard, a cardinal and a crow flying together. That sure would be a sight, though, wouldn't it?
When applied to people, this phrase means that people who are similar to each other or share similar interests tend to spend time with each other. You've probably noticed this at school. The friends that you hang out with probably tend to be people who are similar to you or like the same things that you do.
It's only natural for people with similar interests to hang out together. However, it doesn't have to mean that you only spend time with the same people. People have many different interests, so you may be part of many different groups that share interests.
For example, if you play soccer, you may hang out with your soccer teammates from time to time. But you might also love to play chess, which means you might also hang out with friends who are on the chess team at school.