I like putting on my headphone whenever I want to stay focus. It happens a lot when I m coding. For most of the time, I don't play any music like the others do. The headphone is just there to help shielding out some outside noise especially those that can get me distracted, and it also makes people less likely to interrupt when they see me with the headphone on unless it's something urgent or important.
Sometimes, I do play coffee shop noise in the background, which is kind of funny. It helps simulate the environment where it's a little noisy yet the background noise has no context to get your attention as its like pure noise rather than a conversation. The coffee shop noise trick works particularly well for freelancer or someone who work alone most of the time, as it gives you a sense of people busying around and you will feel less lonely.
FYR, The background noise I listened to are from this site, btw, they do you mobile app where you can bring them along if you need to.
For people like me, developer, I would suggest investing in a good pair of headphone which can do abit of noise cancellation if not cover-head type, and keep them nearby the coding-zone and put them on whenever you want to stay focus and start coding.