All of my writing on Hubpages is music related, so yes I definitely listen to music while I'm writing. Usually, I listen to the album that I'm reviewing while I'm writing it, while I'm editing it, and when I post it here. I find this helpful, as it sometimes reminds me of things I've left out of the review.
When I don't write music related things, I still listen to music. A lot of times when I'm writing something I enjoy more atmospheric music, as it can really get me into a certain mood when I write. I often like folk, black or power metal when I'm writing more of a fantasy/unrealistic story. Death, doom or thrash metal fits better if I'm writing something more realistic or something that's not fictional.