I typically prefer cities to have evolved naturally over the course of history. Therefore my campaign world has to have such a history as to have an impact on a city. On top of that, I consider things such as geography, climate, and other natural influences that could change or alter how the city came to be.
There are a thousand things you can do when creating a city, so don't get overwhelmed. I prefer to do the outside-in approach, making the large general scope of the city and then filling in smaller sectors with ever-increasing details. This can be particularly effective if you know the PCs are going to be contained witin a specific section of the city.
That's all I will go into for now, but there are countless ways to create a city and countless things to consider depending on your desired level of realism. In any case, good luck.