Each situation is different, so it's impossible to provide a definitive answer for every circumstance. However, if you are the one living next to your neighbors and you feel like they're playing too loudly, some advice on how to deal with the situation might be helpful.
First and foremost, if you are the one who feels like their music is too loud, then simply speak to them about it. It can help to have a conversation about why you feel their music is making it difficult for you to fall asleep or concentrating in class. If you're unable to come to an agreement about living together in an environment that's conducive to relaxation or productivity, then some other solution may need to be found.
If you live in an apartment complex or condo where noise complaints are not allowed, then potentially there is nothing that can be done aside from resigning yourself to the fact that your neighbors will probably play music loudly until they move out or get a noise complaint filed against them