There's two main ways to do it. One is if your camera allows aperature control and has a relatively large lens. When you open up the aperature of the lens, you limit the plane of focus, blurring everything in front and behind the focused plane. If you use a bright light source to target the subject (e.g. a flash), it may blacken out all of the image except for the subject, leaving you with a black background look you're looking for. Usually, this is hard to do on consumer cameras with smaller lens and sensors. If you have a SLR or dSLR, this is more easily accomplished.
Another way is to do it in post processing. Photoshop can do it, but it can be a paintstaking process to get right. You basically have to manually black out all the background; the biggest task is working with the edges of the subject so it looks natural and not "cut-and-paste."