WCollins' scenario is one that can be fairly easily mitigated by leaving the gear down for a little bit longer than usual.
Select gear up once you judge it no longer feasible to land on what's left of the rwy AND you have passed at least Vxse. The act of selecting gear up becomes your 'go / no go' decision.
There are caveats to this method though. It depends on the circumstances of the day.
Is there an obstacle that must be cleared?
Is it a short runway that requires maximum climb angle?
Is D.Alt such that a one-inop climb is not feasable?