That's for yukkuris you silly, Salem wanted to know for people. For people in the best case you use ice cubes for the worse case you may need use a scissor and cut your hair.
And as Ukshadow said, for Yukkuris you either burn them or cut down all their hair and accessories just in case, you never know if the magical bullshit of yukkuris makes the gum mutate into some sort of parasitic tumor thingy so for the sake of it's health, or in the worse case, for the sake of other yu's health you either burn it or cut everything down.
Soaking some food oil-based product into your hair, such as olive oil or peanut butter (which contains peanut oil) will greatly weaken the bond the gum has with your hair, allowing you to fairly easily comb it out 20 minutes later. From there, you just shampoo the oil out.
That having been said, good luck getting a yukkuri to stay put that long!
As said, I never had that experience yet. ^^; But seems like when the position is not too close to the scalp, scissors seems to be the most efficient method.