Assuming you play on a level close to regent, there will only be two citizens in each city that are born content. The third and later will be unhappy unless you do something to make them content. In despotism there are six ways you can make them content/happy:
1) Up to two military units in each city will make the same number of unhappy citizens content.
2) Increasing the luxury slider will make citizens happy if the city generates money.
3) A temple will make one citizen content.
4) Each connected luxury will make a citizen happy.
5) Each taxman/scientist will make one citizen content (itself)
6) Each entertainer will make itself content and another citizen happy.
You need to use a combinations of these factors to make sure that the number of happy citizens are equal to or bigger than the number of unhappy citizens. If not, the city falls into civil disorder.
When you switch government, your city will go through a period of anarchy. One turn if you're religious and 4-10 turns if not. During this period, 1) and 2) above stops working. 1) stops because military police doesn't work under anarchy (or republic/democracy), while 2) doesn't work since none of your cities are generating money during the anarchy.
To keep the cities from civil disorder during the anarchy period, you need to use 3-6 to compensate for the loss of 1-2. Since you will not be able to build any new temples during the period, and hardly connect any new luxuries, you're left with the option of generating more taxmen/scientists/entertainers.
As soon as you enters anarchy, open the city view in one city and change the necessary number of citizens into specialists. On regent, a size 6 city without temple and any luxuries will need 2 entertainers. This will typically mean that it produces too little food, so it may loose one citizen during the anarchy, but that's no biggie. A size 6 city with temple and one luxury need only one entertainer. Go through all cities and do this before going on with your turn, and you will live through the anarchy period with little loss.
Note that the only thing the cities produce during anarchy is food, so put all citizens to work on the squares that give most food, so that the city may at least grow a bit during the anarchy.
A tip: by double-clicking on the city while in the city view, the game will do the relocation of citizens to food tiles and creation of the necessary number of entertainers for you. The only problem is that the game will make two entertainers even if one entertainer and one taxman is enough. If so, just click once on one of the entertainers, and you'll get a taxman.
If you enter anarchy during the between-turn period (normallya s a result of having researched a new government), you don't get to enter city view befor the civil disorder kicks in in your first city. But when you get the civil disorder message, enter the city view and fix the city - and here comes the important part: Don't close the city view, but cycle through all the other cities as well, and you get to relocate entertainers in those cities before they go into civil disorder. So it is only one city that will suffer one turn of civil disorder.