Photo editing software is the trick, the better the quality of the software, the easier the job of isolating an image from the original background.
You could take a look at Adobe Photoshop or something like Coral Photo Paint. Both will do a good job, but aren't cheap. Some cheaper programs can do it, however with cheaper software you need the image you want to isolate to be quite distinctive in colour from the background colour, because these programs can struggle to give you a perfect isolation and leave you with a poor quality image that just doesn't work at all well.
The technique in photography terms is called green screening by most. The idea is you can take a pic of an object in front of a solid green screen, although blue is quite often used as well. With a solid wall of one colour in the back-ground, the image is then very simple to isolate and manipulate.
Also popular in video work as well to drop in different locations where required, for example, check out the weather forecast done from a studio. The presenter is actually standing in front of a blank green screen, even though it looks like they are standing in front of the weather map.
It's all based on the same process!