Information is the most valuable resource. Know what is going on and where, so you can avoid or react in the appropriate manner. Stay away from incidents, riots are usually localized to specific areas, usually.

If the situation is prolonged or widespread, know where to go to get away. What direction is best? How will you get there? A bit of analysis before it happens is useful. What resources do you have, what resources will you need?

Stay oriented to your location, have a map, and know where important resources are located (pharmacies, hospitals, law enforcement locations, water, shelter, food, the usual stuff). Know the primary landmarks and how they can guide you to where you need to go.

If you are with others, establish rally points where you can gather if you become separated. These should be easily recognized, easy to access, and in the cardinal directions so you can default to whichever one is away from trouble. Staying out of danger becomes your first survival priority.

As Chaosmagnet discusses, being prepared is the key. Have the knowledge and supplies/equipment you need before it happens. If you wait until after a bad situation begins, it becomes exponentially more difficult.