With airplanes being as reliable as they are, it's easy to have a little too much confidence in their ability to keep us flying. But if an engine failure were to rear its ugly face, you'll be glad you spent some time anticipating its arrival.
Always have a plan in mind for an engine failure on departure. If you don't have enough runway to safely put the aircraft back down on the tarmac, remember that a successful 180-degree turn back to the airport can generally be completed only if you're at least 800 hundred feet or more above the ground. Consider potential landing sites straight ahead.
As you're flying along, always keep a look out for emergency landing sites. Know what's ahead and behind you so that you don't need to spend valuable time maneuvering around to find the best place to land should the engine decide to take a break. Instead, that time could be spent investigating the cause of the problem with a restart as the result.
Once you have reached the best glide speed and selected the best landing site, go through a thorough flow check. Is the selected tank empty (switch tanks)? Was the fuel selector bumped out of its detent or the ignition key accidentally put in the off position? Did you accidentally pull the mixture instead of the throttle for a decent (stranger things have happened)? Could carburetor ice have caused the issue (carb heat on!)?
If the flow check does not result in an engine restart, squawk 7700 and make an emergency transmission either with the controllers you're talking to or on 121.5. Crack the doors and fly the plane to the ground. If you selected a good landing spot, chances are excellent you'll walk away without a scratch on yourself or your airplane.
If these steps are too much to remember, use a mnemonic. I use P.A.N.I.C. Panic — don't; Aviate — pitch for best glide speed and fly the plane; Navigate — select a landing site; Investigate — do your flow check to see if the problem can be fixed; Communicate — squawk 7700 and make your emergency call.