In most purchase transactions there may be a slight challenge or two, but most things will go quite smoothly. However, you want to anticipate potential problems so that if something does go wrong, you can cancel the contract without penalty. These are called "contingencies" and you must be sure to include them when you offer to buy a home.
For example, some "move-up" buyers often agree to purchase a home before selling their previous home. Even if the home is already sold, it is probably a "pending sale" and has not closed. Therefore, you should make closing your own sale a condition of your offer. If you do not include this as a contingency, you may find yourself making two mortgage payments instead of one.
There are other common contingencies you should include in your offer. Since you probably need a mortgage to buy the home, a condition of your offer should be that you successfully obtain suitable financing.
Another condition should be that the property appraises for at least what you agreed to pay for it. During the escrow period you are likely to require certain inspections, and another contingency should be that it pass those inspections.
Basically, contingencies protect you in case you cannot perform or choose not to perform on a promise to buy a home. If you cancel a contract without having built-in conditions and contingencies, you could find yourself forfeiting your earnest money deposit.