A sound wave, in the physical sense, is a sequence of high- and low-pressure that travels through the air from a sound source, much like the ripples that are created by throwing a stone in a pond. If you overlap two sounds which are exactly the same, except that in one the areas of high- and low-pressure are reversed (in technical terms, the phase is reversed), the sounds will cancel each other and you'll have silence.
This canceling phenomenon is used in both of the tricks I mentioned. For the karaoke voice-removal, you need to pan both the left and the right channel of your recoding to the center (in effect creating a mono track out of a stereo track) and reverse the phase on one of the channels. In most cases, this will remove most of the lead vocals. Traditional mixing practice places the lead vocals in the center of the stereo field, so the vocals are equally present in both the left and right channels. When you mash the channels together and reverse the phase on one of them, you are performing the canceling operation on whatever sounds exist in both channels.
The other trick works similarly. If you have two recordings that are mostly identical, playing them together and reversing the phase on one will cancel whatever exists in both recordings but will leave whatever is unique to one of them. So if you have, say, a recording with just drums and a second recording with the same drums and an added bass, doing this will cause the drums to cancel, leaving only the bass.