The Greek city states were in large part sharp by their geographical context. Greece is very mountainous, and the soil is of poor quality. Therefore, there were always limitations in terms of the populations these cities could support, a challenge which led to the establishment of colonies. At the same time, this geography proved a significant barrier to internal communications. The Greeks relied upon the sea, and Greek civilization was spread out across the Mediterranean world. These geographic realities, however, made large-scale political unification extremely difficult. This resulted in the rise of various competing city states.
In addition, you should look towards the larger historical context, involving the collapse of the earlier Mycenean civilization and its larger consequences for Greek history. This resulted in the Doric Age, where Greek civilization largely had to be rebuilt. To quote historical experts, "from 1200 until 800 B.C., writing disappeared from Greece; the country's population shrank and was isolated from the wider world" (Ian Morris & Barry B. Powell, The Greeks: History, Culture, and Society, Pearson Education, Inc: Upper Saddle River, New Jersey: 2006, 4). It was in this context that Classical Greece was shaped.