How are communities formed according to sociology?

How are communities formed according to sociology?