Gum can be tasty to chew, but it sure is a nuisance when it get stuck to anything—especially your shag carpet! The long carpet fibers make it quite difficult to remove the gum, but, if you follow these steps, you stand a pretty good chance of having a presentable, clean carpet again.
Step 1: Freeze the gum.
Gum is easier to pick off of anything when it's cold. Grab an ice cube, and hold it against the gum. If there's a lot of gum on the carpet, freeze a small section of the gum at a time. You'll need to hold the ice against the gum for at least 20 or 30 seconds to make the gum really hard. Then, use your fingers to pick off as much of the hardened gum as you can. Repeat this process, freezing and picking the gum a little at a time, until you're no longer able to pick off any more gum.
Step 2: Use a "goo remover."
Most home improvement stores and even some grocery stores sell a type of cleaner called a "goo remover." This is typically an oil-based cleaner that contains some citrus extracts. Apply some goo remover to a cotton ball, and dab it on the gum in the carpet. Yes, it will make you carpet a bit oily, but it should also essentially dissolve the gum so you can wipe it up off the carpet. Try to use as little goo cleaner as you can. Work on one carpet fiber at a time to avoid spreading the goo remover all over.
Step 3: Remove the goo remover.
Your carpet should now be gum-free, but you're left with an oily-looking spot. Luckily, you probably have just the thing to remove the oily goo remover in your kitchen: dish soap. The concentrated kind works best. Put a squirt of dish soap in a bowl, and fill it with warm water. Then, use a sponge to apply the soapy water to the oily spot. Rub the spot gently to work up a lather. Then, use a thick stack of towels to absorb as much of the soapy water as possible. Repeat this two or three more times.
Once you've blotted up as much of the soapy water as you can, use your hands to fluff up the carpet fibers or run a vacuum over the spot. Let the carpet dry, and you should be pleased with the results.