Some cities are located by chance. A wagon breaks down, the driver spends some time in repairs, finds
that he is in a congenial spot, and settles down. Later another person builds a house near his, and later
someone adds an inn. Someone else starts selling farm produce there. Soon there is a little market, which
grows to a town, and later to a city.
Other places were destined by nature to become cities. London, for example, is on what is called the head of navigation - the point where it becomes too difficult for ocean-going ships to continue upriver, and must transfer their cargoes. As with London, the head of navigation is also the point where the river can be conveniently bridged. In fact, the location of a bridge is often the reason for the birth of a town - as Cambridge or Weybridge in England show. Again, a good harbor will generally lead to a city growing up about it. New York and San Francisco began life as ports, as did Cape Town in south Africa.
Some places were created mainly for military purposes, such as Milan, and the host of English cities finishing with - cester, which is derived from castra which means camp in Latin. Chester itself, created to guard the Welsh border is a very good example. Other such military bases are Manchester, Doncaster, and of course, Newcastle.
A few cites are not created by accident, but by intention. This was the case with Milton Keynes in England, but the most famous examples of such cities are capitals. Brasilia, Canberra and Washington are capitals created in modern times, but even their greatest admirers will admit that they lack a certain character. It is no co-incidence that there are famous pop songs about New York, ("New York, New York") Chicago ("My kind of Town") San Francisco (Going to San Francisco") and many other US cities, but none about the nation's capital. On the other hand any Londoner can give you at least three songs about the place.