A city wall is simply a wall that surrounds a city. Given the size of modern cities and the power of modern explosives, ramparts are currently wildly impractical, and city walls are no longer used. But in past centuries city walls were important defensive structures, and kingdoms could live or die based on the fortitude of a city's walls. Before gunpowder was in common use walls were effective barriers to invading armies, and the lack of a wall was an open invitation to pillaging. As long as a city had adequate water, food, and walls it could simply close its gates and shut out any aggressors. If an invading army was able to storm a city, often their first action was to raze the walls, unless they intended to occupy it themselves.
The state of a city's wall was once a good indicator of the state of the city; a crumbling wall was a clear sign of an ailing economy. The gates were critical parts of the city wall (well, for obvious reasons, but also...) because taxes were collected on any goods entering a city. Gatekeepers were also tax collectors, and the revenue from imports could be an important source of income for the city.
City walls could become quite constricting as the city grew and needed room to expand. A wealthy city might be able to build a larger wall to contain the new growth, something that happened multiple times in Paris. Often the expense of a new wall was too great, and outlying areas were surrounded by a lesser wall (these days these areas are most often referred to by their German name, Vorstadt), or might simply be left unprotected (these outlying areas are often called by their French names faubourg or banlieue). Because cities often shut their gates at night, one of the first structures built outside the gates were inns, the last resort of the tardy traveler.
Cities that still have well-known, albeit derelict, city walls include Dublin, Jerusalem, Alexandria, Istanbul, Cartagena, and Xian. Many cities have bits of walls tucked away in odd corners, such as London with its blitzed segment of wall in the City of London zone, well in from the current outskirts of the city.