In partial answer to your question, yes, there have been several studies involved in this particular field.
Some findings include:
According to the article "The need to belong: Desire for interpersonal attachments as a fundamental human motivation" (Baumeister and Leary, 1995), concluded that
that human beings are
fundamentally and pervasively motivated by a need to belong,
that is, by a strong desire to form and maintain enduring interpersonal
attachments. People seek frequent, affectively positive
interactions within the context of long-term, caring relationships.
An important finding in that paper is that their research found that humans more readily make social bonds and resist dissolving them. Essentially, we tend to 'stick around' rather than walk away. Specifically (from the article:
Not only do relationships emerge quite naturally,
but people invest a great deal of time and effort in fostering
supportive relationships with others. External threat seems
to increase the tendency to form strong bonds.
Further, according to "Psychological need-satisfaction and subjective
well-being within social groups" (Sheldon and Bettencourt, 2000), concluded with a key point related to your final question (bolding mine):
that formal group membership may come
with some trade-offs: one gains a more distinctive group identity, but may sacrifice
some personal freedom. Conversely, it seems that members of informal groups are able
to feel greater autonomy and individual uniqueness within such groups, but they may
not derive as much pride or sense of identity from comparing their group to other
groups (Brewer &Pickett, 1999).
I hope this helps a bit.