The way it feels to me is it gives me a consistent background to work. For example, once I have decided on a particular way to solve a problem and its time to code - I put a long DnB track.
Another way to describe it is that it gives my brain's CPU a consistent clock, so to speak xD
When I really get focused on a bit of work, whatever music is playing literally disappears - if you came to me 3min later and offered me $millions to tell you what song just played, I'd get nothing.
Cats are even more amazing - I can't find it right now, but I remember in reading studies in some of my college neuroscience classes where electrodes were put on cats to track their audio system with a clock/metronome sound in the background. You can trace the signal processing up through various nodes of the system at successively higher levels. When a mouse was let into the area, the metronome click trace disappeared from the data of almost every level of processing - it was entirely filtered out almost at the raw audio stage when the mouse showed up. That's focus.
I know lots of people though who must have music on, or they simply cannot concentrate. For them, it might be that the music gives the mind something to hold on to, kind of a rail to help stay on track, and in the absence of that, their mind would wander farther afield.