When riding through bad neighborhoods, I don't do anything differently other than make an effort to pay attention to my surroundings.
95% of conflicts can be avoided by good situational awareness, listening to 'bad feelings' your gut may be telling you, and avoiding the situation entirely (e.g. avoiding large groups, as mentioned by somebody else).
Most of the remainder can mostly be handled by keeping your cool, making it clear you're not a threat, and an absolute dedication to swallowing your pride.
For the few situations that can't be handled any other way, I carry a (legally) concealed handgun & pepper spray (which is not to say that I think I 'only' need them in 'bad' neighborhoods - bad things can happen anywhere).