Listening to music isn't directly related to writing. Authors have produced classics in relative silence since the advent of the novel. Some authors in the '70s and '80s admitted that they listened to the radio while they wrote, but that was nothing on the distractions of the modern age. Most computers have a built-in CD player, and anyone can import music into the computer to carry around their entire music library, accessible at a click. There are also music services like Pandora and Spotify where you can listen to just about any songs online (and I've discovered a ton of new music through both). Go to any coffee shop, and you'll see most people plugged in with earphones, some of them bopping their heads to the beat while they type away.
I'm listening to music right now, in fact, and I don't get far in my writing without music playing in the background. TV, conversations, and unexpected noise are a distraction. Music is part of the writing process for me.
Not the editing process, though. I find I'm more willing to read over awkward phrasing or typos with music playing, even when the volume is low. Music's rhythm encourages me to keep moving, so it's not conducive to pausing at something I need to fix.
I'm not the only one who writes with music. At write-ins, everyone else in the writing group pops in headphones as soon as we're getting down to it, and any interruption involves taking one out to hear what someone is saying. It's to keep us focused, to show others that we're busy and not up for conversation, and to keep up the momentum.
I've heard some published authors talk about the music they listen to while they write. One clever YA author made an index of of the songs she listened to while she was writing the book, which helped me connect with the words on a whole different level.
It seems that writers approach this as different as any other technique or tip, though. They adapt it to their own needs. I can't listen to anything slow or droning when I'm writing, or I start writing maudlin treatises on why the characters' lives suck. So I have a playlist I call "Motivation" of peppy, upbeat, high-energy songs. I also listen closely to the lyrics when I'm not writing, to see if a character whose head I'm having difficulty getting into might relate to the song. If I find that to be true, I'll play that song or the group who played it until I've figured out the character's motivation.
Others in the writing group separate out their music into moods, or types of scenes, and play the music for inspiration. That doesn't work for me, but to each one's own.
Recently, Lifehacker posted an article about using timed playlists to increase one's productivity. (Giving credit where it's due, my husband Josh was the one who linked it to the writing group's email list.) I could quickly be mired in the time-consuming process of crafting well-balanced playlists, so I'm giving that a pass.
Other writers choose not to listen to music at all because it distracts them, or choose to only listen to certain genres, or to listen to one song on repeat until they've finished a particular scene.
Like a lot of writing techniques, there is no absolute right or wrong way to use music. It's what works for you. The only advice I'll give you is to be aware of the effect music has on your writing. See if it distracts you, or if you produce more words when you're listening to a particular type. Even if you don't particularly like an artist or a genre, you might find that listening to it in the background so that you can barely hear it keeps the distractible part of your brain from acting out. It's worth a try, isn't it?