A subject can be put against a different background through chroma keying, also known as the blue-screen or green-screen technique.
Simply "whiting-out" an image's background and then making it transparent can lead to bright areas on the subject being removed along with the background. To avoid this, pictures should be taken against a solid-color background. The usual choice is blue or green, depending on the colors in the foreground and the subject itself.
Once you have photographed your subject on a solid-color background, that background can then be removed just as if it had been "whited out" - except that here, you'll need to manually select the color of the background to be removed.
When you photograph a subject and want to remove the background later, avoid having any reflection coming from that background. In this example, there's a green afterglow on the model's bangs.