When the take-off is a sure success, or cannot be aborted. For example, when taking off from a carrier, a fighter retracts gear as soon as possible, as it doesn't need it anymore. When taking off from the runway, a plane will retract landing gear when it reaches a stable flight mode. Until that moment, it's kept out to soften the impact in case of of stall, or to be ready in case of a problem that requires an emergency landing.
Plane takes off.... Flaps up..... Positive rate, gear up.
When they start accelerating in their ascent. Usually right after they lift off. The flaps go up first tho.
For airliners, its when a positive rate of climb has been verified on the vertical speed indicator or whatever its called.
When the take-off is a sure success, or cannot be aborted. For example, when taking off from a carrier, a fighter retracts gear as soon as possible, as it doesn't need it anymore. When taking off from the runway, a plane will retract landing gear when it reaches a stable flight mode. Until that moment, it's kept out to soften the impact in case of of stall, or to be ready in case of a problem that requires an emergency landing.