As often happens, I'll take the contrary position and suggest that this isn't really a good question. Gunfire in places like Times Square is kind of unusual.
Take a look at this story. As one would expect...
Like Fisherman's Wharf in San Francisco, or downtown Chicago, places like this usually have very heavy police coverage and from a perp's perspective, a getaway can be problematic. If you see roving packs or gangs, it's best to avoid wandering into them. More likely, trouble will happen in more secluded places (not always, no, but usually) where there's less risk of witnesses and interference.
As for Times Square, there is cover everywhere - doorways, vehicles, pillars - all manner of places to duck Trouble won't often follow you into the street. So good situational awareness is essential. Muggings I know about in downtown, congested areas, tend to be ridiculously banal. Typically, person or two in front stops you, brandish a screwdriver, guy in back closes you in, and you're relieved of valuables right there on the spot, with people streaming all around you.
Street sense should keep you always avoiding places you can be boxed in and trapped. Scan constantly for problems and move in the rhythm of traffic.