A home inspection contingency states the buyer will be allowed to opportunity to have a professional inspect the property. It also gives the buyer a set amount of time to have the inspection done and the results back to the seller.
One of three things can happen when issues are discovered during an inspection. The buyer can terminate the contract and have their earnest money returned. They can ask the seller to remedy the problems, or they can ask the seller for a monetary concession.
If an agreement cannot be reached the buyer would be entitled to get their earnest money deposit back as long as they notified the seller in the agreed-upon time frame.