Follow the ABC checklist - Airplane, Best landing site, and Cockpit. In other words, fly the airplane, choose a suitable landing site, and if you have time, attempt to restart the engine.
AIRPLANE - Do not look inside the cockpit! Look outside at the wing tip and fly the correct pitch attitude. Before you have an engine failure, fly your airplane's best glide (most distance) speed and minimum sink (most time) speed, look at the wingtips' relationship to the horizon, and remember it. In many airplanes, at best glide speed the wingtip is level with the horizon, and at minimum sink speed the wingtip's leading edge is slightly above the trailing edge.
BEST LANDING SITE - While you are looking at the wingtip to establish the correct pitch attitude, look for a landing site. Chances are good your instructor taught you always to be aware of surface wind conditions and suitable landing sites. If you do this habitually and an engine failure occurs, you'll seem to have more time, and you'll be more decisive. This important habit also allows you to stay calm and think logically, a mandatory piloting necessity in abnormal situations.
Your workload increases dramatically if you don't have a landing site in mind. Now you must enter momentary left and right turns, look directly beneath you, then search outward from that point. Turn to a downwind heading, if feasible. Because an airplane flies relative to the air mass around it, gliding downwind increases your ground speed and, thereby, your glide distance - and the probability of finding a landing site.
You'll seldom need absolute maximum glide distance, but if you do, check your airspeed and adjust pitch attitude to establish the exact speed. Minimize propeller drag by pushing the throttle full open, which reduces engine resistance to the rotating propeller, and if your airplane has a controllable pitch propeller, select the low-rpm, high-pitch propeller position.
At low altitudes, you must pick the area of least resistance and land straight ahead. The amount of time you have to complete a turn increases with altitude. Your highest priority is to achieve an upwind landing with low ground speed. Your least desirable choice is a downwind landing with high ground speed.
The area of least resistance implies a landing site that offers the least chance of damaging the aircraft's occupants. If you can't find an open, smooth spot, pick an area that might damage the wings but not the fuselage. Two trees that stand close together like a football field's goal posts is a good example. Many pilots have walked away from seemingly impossible situations because they aimed the fuselage between the trees and let the wings take the punishment.
COCKPIT - Use a cockpit flow pattern when you attempt to restart the engine. Engine failure is the real reason for teaching flow patterns, because you may not have time to consult a written checklist.
You must switch fuel tanks, turn on the fuel pump (if so equipped) and carburetor heat, enrich the mixture, and - if nothing else works - isolate the magnetos. Use caution if the engine starts to run for no apparent reason. It may quit again just after you abandon your approach.
On final, you should turn off the fuel selector and the master switch, and open the cabin door. If structural damage occurs, a closed cabin door can jam shut, trapping you and your passengers in the airplane.
SECONDARY CONSIDERATIONS - When you've completed the ABC items - and time permits - you can consider secondary items.
Advise someone about your emergency, particularly if you're in a remote area. If you're in radar coverage, squawk 7700 on your transponder. Make a mayday call if radio reception permits. Finally, prepare in advance, file a VFR flight plan and make periodic position reports to flight service. If you can't contact anyone by radio, people will start looking for you when you don't close your flight plan. When you fly in remote areas, you should always carry basic survival items including water.
As you accumulate experience, don't attempt to reinvent the wheel. Pilots have used the emergency procedure described here for years. Know it cold, know your airplane, and continually evaluate surface wind and forced landing options when airborne. This is your best insurance for a safe forced landing.