An old pirate theory goes that an obstacle that you can see is not an obstacle.
Of course that is nonsense, but in the case of a L/G down departure, I think you will be able to assess very clearly if you have a problem or not.
But, both the L/G down and an engine failure on top of that? Wow, that's not your day! there is a procedure for that, though:
FINGERS………CROSS
Personally I don't know what I would do. In my airplane, avoid obstacles visually, if in IMC go for the EOSID and pray, or "fly the black", or try to return overhead the airfield, although such turn would kill most of my climb ability…
FINGERS……..CHECK CROSSED