I'll preface this by saying I don't condone or defend violence against people or the theft or destruction of property under any circumstances. I do think that what happens during protests is complex and unpredictable, and usually there is plenty of blame to go around on all sides when they turn violent and destructive.
Historically, groups with an agenda have sought to spark violence during protests. There are well documented instances of this over the past 150 years or so in many places, including the US. At times it has been the police using officers in plain clothes (or paid civilians) to commit violence, seeking justification to disperse crowds or to punish protestors, and at others it has been groups with extreme viewpoints seeking to create chaos. Sometimes it's a group that believes that violence is the only way to make a message heard or foment change. Sometimes it's a group looking to discredit the cause of the protestors. And sometimes it's just angry, unruly people looking to loot.
Sometimes, protests become violent when police and the governments behind them consider the protestors to be the problem rather than the issue that led to the protests. Peaceful protestors are confronted, and the police try to exert control even when aside from disruption, no harm to people or property is being done. People get angry when they're treated unjustly or disrespected, and in groups, emotions are magnified and can very quickly escalate. All it takes then is one small act on either side to trigger a riot. Past that point, violence doesn't become justified, but it is definitely understandable. Once it starts, everyone involved bears a responsibility to try and de-escalate the situation. More fists, rocks, tear gas, clubs or handcuffs won't help the situation, it just throws fuel on the flames.
We can look at what happened in Flint, MI and Camden, NJ and learn something. There, police acknowledged the wrong that the people were protesting. They joined with the protestors instead of confronting them, and in those cities - both of which have struggled with crime, poverty and racial tensions - there was peace instead of riots and looting, and destruction.