Looking back in history to see where communities have located and developed can give us some clues about this. The forms of transport for connecting to market and other communities has been the most significant factor. Communities locating by the sea and rivers when boats were the main way of traveling. Otherwise Maslov's hierarchy of needs is also relevant to this. The need for shelter, water, food and safety. the Maori Pa sites in New Zealand are usually located on the most prominent high ground to provide safety in the times of warfare.
In the UK there are several communities that have taken over stately homes or large houses where there are many rooms and large kitchens and these can be perfectly set up to provide a space for multiple occupancy. At Osho Leela in Dorset there are now many attached mobile buildings, as in Findhorn this happens when people want to be in the community but want their own space. Osho Leela is held together by the teachings of Osho and the community has the glue of regular dancing together and has a source of income through being a workshop space.
Other communities have taken over deserted villages in remote areas of Spain, for example, Matavenero village a remote mining village abandoned in the 1960's now has 60 people living there mostly Germans but also other Europeans wanting a more eco-friendly existence they aim to be as self-sufficient as possible and share a communal telephone line.
Other people have bought farms or bare land and developed those into intentional communities. Often these start with people living in caravans as they build their own homes.
A group of houses close together or people living in the same block of flats or a stately home is not a community by default. You can live in the same building as someone for decades and never talk to your neighbours. To create community there needs to be an intention, places where people can bump into each other and connect, shared activities to create community glue and some shared values so that the people respect each other.