More specifically, contingencies give you a way to cancel the contract and get your earnest money back if something goes wrong, like your lending falls through or the inspection uncovers major problems the seller isn't willing to repair.
If the seller refuses, or if there are major issues that make you not want to purchase the home, you can cancel the contract under your inspection contingency.
Just like with any other type of insurance, it's important to carefully read the policy and know what's covered and what's excluded, what your deductible is, and if you need to purchase any additional insurance, like flood, that isn't included.
Your agent may also suggest purchasing a home warranty during this time that will repair or replace major systems that fail in the home within a specific time frame (usually 1 year after closing, but there are many warranty plans available).