In short, chemical drain cleaners can usually take care of a clog. However, it's more of a question as to which drain cleaner works best for which clog, because if you use the wrong drain cleaner, it simply won't work.
Grease and Food
Clogs like grease, food, and other slimy bits tend to happen in the kitchen. One way to prevent this is to simply not clog up your sink with it. Throw your food in the trash, making sure not to let any small pieces into the sink. Put your grease in a can or other disposable object, instead of the sink. Grease is not meant to be poured down the drain. It coats the drain and causes it to grow smaller and small until water molecules simply can't pass through it any longer.
For grease and food clogs, it's best to use a sulfuric acid-based product. These products include Drain Snake, Clobber, and others. Because they're sulfuric acid-based, they will smell terrible and strong, but they'll get rid of that clog much easier than if you were to use the wrong product.
Hair and Soap
Soap scum, hair, and other similar messes tend to clog up drains in bathroom sinks, tubs, and showers, mostly. For clogs such as these, it's best to use lye-based or sodium hydroxide-based products. These are usually marketed as products like Drain-O, Open Wide, and Glug. For simple clogs like this, lye or sodium hydroxide will clear that right up.
Sometimes, drains are slowed by urine salts or hard water. This is commonly found in the bathroom, but can happen to all drains in the house. A simple fix is to use hydrochloric acid-based products, like D.E. Cleaner. This is also good if you want to speed up your drains a bit even if there isn't a buildup of salts or hard water.
You can't stop nature forever – even when it comes to roots and other herbs growing right into your pipes. Eventually, you'll have to repair your pipes and de-root whatever your problem may be, no matter how costly. A temporary solution, though, is to use herbicide-based products, like Rootx, Foaming Root Killer, and others. The products are designed to kill the roots after you've manually snaked your drain. It doesn't stop clogs very well, but will temporarily hold your problem at bay.
Most people are uninformed as to how to unclog their drain, mostly because they don't realize the difference in products and ingredients. Once you realize what you need, though, you'll be able to unclog your drain easier, no matter what the problem may be. Stay informed and make sure that you get your drains cleaned manually by your local plumber occasionally, so that you never actually have to face the threat of an annoying clog.