How does a protest turn into a riot?
1. The rioting was preplanned by the person(s) who organized the protest.
2. Agents Provocateurs were planted into the protests by the local or national law enforcement.
3. Law enforcement chose to stop the protest by any means necessary.
Hints for protesters: know the person next to you. If he hands you a stick or a brick, drop it and point him out to the others. Do NOT steal, break, or burn other people's property. The first people in the protest who behave this way are likely cops, so be careful. Frankly, if I was protesting, and I saw somebody I did not know breaking the law, I would be out of there fast.
Hints for cops: First, do nothing but observe the crowd. Watch for the noisiest protesters. At the first sign of a crime, detain THAT person, and let the others continue. If the protest turns into a march, continue detaining violent and abusive protesters. Do NOT hassle the press or the clergy. Finally, do not show up as Seal Team Six wannabes. Wear a vest under your uniform shirt, and carry light weapons, like your pistol and taser. Act like cops, not an occupying force.
Remember that after the protest, no matter what happens, cops and protesters have to live with the aftermath.
The whole world is watching now that we have the Interwebs. Try not to embarrass yourself or your town.