They believe they can harass and assault -- especially an outnumbered individual -- and that there won't be physical consequences. Sure, plenty of them are concerned about being doxxed, hence the frequent masks. And in more liberal areas, they know that an arrest is quite unlikely.
The guy assaulting him with a megaphone didn't expect to get battered. And the others that ran in thought that numbers would help them.