I’ve heard it as; “it shows like-minded people that there are also others who care about a cause.”
Anti-abortion laws might get passed and you may think “wow, I can’t believe everyone thinks that way” and then a protest happens with thousands of people in attendance and you realise your view isn’t irrelevant. This can lead to people moving for change.
Unfortunately, this also works for bigoted protests, like anti-immigration protests bringing all the dickheads together to a shared cause.