Using music in your campaign can be a great way of adding ambiance. It can also make your players want to punch you right in the mouth. Dungeons and Dragons is a completely different experience from watching a movie, so when choosing music, you actually need to think about what you're doing - or you risk detracting from the players' experience rather than enriching it. In simple terms - it's easy to fuck this up, so pay attention.
A good rule of thumb is 'ambiance over catchiness'. If it's unobtrusive and works with whatever is happening in the game, then you're laughing. But if it's distracting your players from the awesome game you just put together, you have a problem.
#1: Do - Think about what kind of game you're running before you choose what type of music you will use. Is it an epic fantasy? Gritty sci-fi? Creepy horror? Set in an exotic country? Do you want to add immersion or just a bit of fun? Do you want your players to feel energized, or to be gripping their seat with white-knuckled hands, wishing they'd brought a spare pare of knickers with them? Once you've decided, keep it in mind.
#2: Don't - Just play thrash metal all over everything. It will be really bloody hard to concentrate on what you're saying, and you'll end up having players ask you "uh, what are we doing again?" right in the middle of an encounter. Then you'll just want to roundhouse kick them in the face, and that never ends well.
#3: Do - Mosey on down to your local library (you know, that place with all the books?) and peruse their CD collection. The soundtrack, 'world' music and new-agey sections are a good place to start, because you'll find all sorts - lush strings, lutes, percussion, all that great kind of stuff.
If you search for 'meditation' CDs you'll come up with ambient noise, like waterfalls with birds cheeping, you know, the kind of stuff that you'd never in a bazillion years listen to otherwise - but that doesn't matter! All you're looking for is background noise.
Be aware that you might have to get creative with your searching, because people who work in library cataloguing are poor, confused souls. To be honest I'm not sure they're even real.
#4: Don't - Pick tracks with obvious vocals. Jaysus, you'd think this would be obvious, but you people are just disappointing.
Also, screaming vocals. NO. Bad DM! I can't hear a word you're saying! Oh, and singing along with the lyrics? Definitely out. Players don't like to see their DMs having more fun than they are.
#5: Do - Actually pay attention to what people in your game group like to listen to! They're your friends, aren't they? Don't just FORCE super loud techno beats on them! This session isn't about you, it's about ALL of you having fun! (And really, what's the point in listening to your favourite music unless you can rock out... without knocking your D&D miniatures everywhere?!)
#6: Don't - Feel your 'battle music' has to be loud. Of course, it comes down to personal choice here, but sometimes a very long or complicated encounter will benefit from having the noise turned down. A bit of subtlety on your part encourages thinking outside the box on your players' parts. Wow, that sounded cool, I should write some of these down...
#7: Do - Approach well-known, iconic music with CAUTION. Star Wars, Lord of the Rings, Pirates of the Caribbean, Final Fantasy... they're all good places to look for music, but if you suddenly have a room full of nerds singing along with the Imperial March... well, it won't be pretty. Ask yourself, 'how tempting is it to include this track because it's awesome and everyone knows it?'. If the answer is 'very', then DON'T.
#8: Don't - Use Sephiroth's theme. It's not funny, it's not clever, and you are NOT being ironic.
#9: Do - look for music that is likely to be unfamiliar to your players. I read somewhere (actually it was on cracked.com, but it's on the internet so it must be true) that music that is familiar to listeners can alter their perception of time. If they love that particular piece, they perceive time going by faster than it really is (read: it's bloody distracting as they'll be paying more attention to the music than they are to your game) and if they hate the piece, the opposite is true (read: you will essentially be annoying the crap out of them).
I also once read that simple, catchy pop music is like heroin for your brain as you actually derive pleasure from anticipiating the melody before you hear it. I'm not actually going anywhere with this, I just thought that was an interesting fact.
#10: Don't - Use Sephiroth's theme. I mean it.
#11: Do - Incorporate moments of silence, or very quiet (NOT OBVIOUS!) sound effects like creaking into a horror-based game. Works like a charm, and will give your players the willies. Even better, if you can somehow make doors in your house creek at opportune moments...
#12: Don't - Use crappy speakers if you're going to disregard all my other advice and insist on playing your music loudly. In my (albiet limited) experience with laptop speakers, they just make your music sound like it's coming down the end of your telephone - although if you're just playing quiet and inobtrusive sound effects or background music like a good little DM, that won't be such a problem.
#13: Do - Organise your tracks into categories or something so you can open the ones you want all together, and quickly. There's nothing wrong with just putting them in different folders on your computer... as long as you don't spend ages getting the things to play - this just breaks the flow of your game, and it's REALLY BLOODY ANNOYING.
#14: Don't - Pick out specific tracks for every little event in your game. It's extra work for you tracking them all down, the risk of you screwing up will be greater, and your attention-starved who- I mean, players, will get bored if you spend too much time fiddling around with the music instead of actually playing. This isn't a movie, it's a game. Try just making up generic folders for the different types of situations you'll encounter. I.E 'creepy dungeon', 'battle' and 'busy town'.
#15: Do - Resist the urge to use MIDI music. It's not 1998 anymore.
#16: Don't - Use Sephiroth's theme. I'm not even kidding.
#17: Do - Carry on as normal if you can't get your music to play. If you or the players honestly miss it, then you've been breaking my rules and I will hunt you down.
TL;DR if you're going to play music, make it instrumental and turn it WAY down, and you'll be right.