A lot of writers have very strong thoughts about music, whether it be a crucial writing aid or a do-not-pass-go distraction, or even whether the writer is a musician themselves. (A lot of fantasy writers seem to be Celtic musicians, or perhaps I just notice that selectively because I am one myself.)
From my secondhand understanding of how music and the brain interact, it should be hard to write while listening to music with lyrics - the lyrics engage the same part of the brain that is used for writing. Instrumental music doesn't interfere in the same way because there is no language for the brain to interpret. Never mind the science of it, though, I know writers who swear by their favorite tunes when they hit the keys.
For me, I can't listen to music while writing: it distracts me too much. On the other hand, I love to use music as a brainstorming aid, and it accompanies me through much of my day-to-day life ... and being an incubator of stories, I plot while driving or cooking or other activity of choice, whether consciously or not.
There's another way I use music to help me in my writing: when doing my prep work for novels, I single out songs from my collection to identify with specific characters, relationships or situations. Then, when those songs come on in my listening, I am quickly brought to pondering the character (relationship, situation ...). Given the way my brain works, I would be willing to bet I do this even when the connection isn't consciously brought to mind.
I do reuse the same song for future projects and new characters, and usually, "reassigning" a song will change the mental associations ... but not always. Years later, Gloria Estefan's Dangerous Game still brings me back to Miayde and Treddian from Butterfly's Poison.
Sometimes, my choices are more snarky than serious. For instance, in Scylla and Charybdis, where the main character was raised in a female-only society that uses Amazon names, I put the following on the novel playlist: Kirsty MacColl's Us Amazonians. I should hope it's obvious that very little about this song applies either seriously or literally to the story!
And, of course, other times, my song selections are more about feel than the precise lyrics. Going all the way back to Flow, I've always associated Ghost In The Machinery (Sarah Brightman) with Kit. (For those of you who are familiar with and like Brightman, her album "Fly" is a very wonderfully weird side-step from her usual fare.) Yet there is almost nothing in the lyrics that is specifically relevant to the storyline.
I "find" songs, too: abruptly discover that something I'm listening to applies to a character. I think this is what always appealed to me about Glee, for all its (many) flaws: that joy in "found" music.
All this is a roundabout way of saying that music is an important part of my creative process, but as part of the backburner, behind-the-scenes development rather than a writing companion.