Loyalty is a city's measure of its devotion to a civilization. Every city has a Loyalty value from 0 to 100, which reflects how much the Citizens of the city want to stay as part of your civilization. When the Loyalty drops to 75 or below, the city's yields and growth are penalized. When Loyalty reaches 0, the city revolts against its owner and becomes a Free City. Free Cities belong to no civilization and will seek to defend themselves from military intrusion. If a Free City's Loyalty drops to 0, its experiment of independence fails, and they seek to join a civilization. Which civilization they request to join depends on who exerted the most pressure on the Free City during their independence. In this way, a Free City may be peacefully brought into your civilization (or brought back into your civilization).
Loyalty changes each turn based on many factors, but the most important factor is pressure of Citizens who live near or in the city. If pressure from your own Citizens outweighs pressure from other civilizations, the city's Loyalty will increase (up to +20 per turn). If other Civilizations' pressure is stronger, the city's Loyalty will decrease (down to -20 per turn). Each Citizen exerts a base pressure of 1, but it can be modified. For example, Citizens in a Capital city exert an additional 1 pressure. Golden Ages and Heroic Ages add 0.5 for all Citizens, while Dark Ages subtract 0.5. This Citizen pressure affects cities within 9 tiles, but is 10% less effective per tile distant.
The city's Governor and Happiness level are other strong factors that affect a city's Loyalty per turn. Additionally, cities conquered with military force will receive Loyalty penalties, but these can be mitigated by keeping a garrisoned military unit in the city. Use the Loyalty lens to get a view of Loyalty factors, including the sources of pressure from other nearby cities. A complete breakdown of factors affecting a city's Loyalty can be viewed in the Loyalty and Governors section of the City Details panel.