The chances are better that people will think of themselves as belonging to a common group if they actually interact with each other over time. Michael Laver in Invitation to Politics describes that in Northern Ireland Protestants and Catholics take different routes, shop in different stores, and use different post offices, etc. Residential racial segregation has, of course, created separate white and black communities by enabling people to avoid interacting with each other. Observers of American life have noticed many things we have done to undermine the stability of interactions, and hence the sense of community among us. Social and geographic mobility and the replacement of extended families with nuclear families are obvious.
Architectural design is instructive.
Suburban design with long streets and back yard private space, etc. prevented interaction. Likewise, when urban slums were replaced with high rise projects, public spaces were lost, and the result was disastrous. We are only beginning to learn about the kind of ties which create sense of community among people, and how to make them work. Almost a generation ago, political commentator Kevin Phillips observed what he considered a disastrous deterioration of an American community. The trends he observed in the mid 70s are far more accurate now than when he wrote them, but whether they are deterioration rather than progress remains a matter of debate.