Really large programs are like med school / high school where it's possible to be somewhat anonymous and for there to be different cliques.
Smaller programs tend to be more of a self-contained social group.
It's like any other job, really--a lot of people become friends, but some people prefer to keep their work life and personal life separate. The problem, especially in busier residencies, is that you'll be lonely if you're not friends with the people you spend most of your time with.
Sometimes residents date each other.