Summary:

There are a number of things you can do to improve a city's defenses. You may "garrison" a strong unit in the city. A melee unit will greatly increase the city's defensive strength, while a ranged unit can fire outward from within a city at nearby enemy units.

You may also construct Walls and Castles that will improve the city's strength. A city on a hill gets a defensive bonus as well.

No matter how powerful a city is, however, it is very important to have units outside the city supporting it.

See the section on Combat for more details.