Cha-never (yet) had an actual engine failure...rough running a few times with some interesting returns. What I was taught, particularly over forest/mountainous terrain was:
Trim for best glide
Run the restart drill
Aim between trees...the branches will further slow you down and reduce impact forces - plus more than likely leaving the fuel tanks behind you.
If no trees (bare mountain) slow to stall and attempt to land "up hill". ALOT easier said than done, though.