We face this a lot on the hall at school. We try to be civil as much as possible and most of the time it works out.
The general rule of thumb for us was usually, if it's during day and you don't like their music then turn it up louder, whoever's got more power wins
At night it was expected to respect each other by using headphones or keeping it at reasonable level. Also, playing Dance-Dance Revolution at 2 am is not a good idea when there are people below you.
But being polite went a long way. Sure there was the occasional asshole but one the whole things went well. So, like others have said, have a talk with your neighbors and get their input and work something out that will please all parties as much as possible. If they are assholes... then see my rule for daytime noise