It has to do about how much fuel is left in the rocket. For LEO, there may be enough fuel left to return to “Terra Firma”, but when the rocket is too far away from land, the amount of propellant just isn’t there and the only option is to attempt a landing at sea.