Like-for-like storage tank
Fits when: The existing installation works, the capacity suits the household, and the gas or electrical supply and venting are already right for it.
Trade-off: The simplest and least disruptive replacement, because the connections, the vent, and the space were designed for this. It reproduces the same lifespan and the same eventual failure, which is a reasonable trade when the unit served its full life without incident.
Storage tank, resized or relocated
Fits when: The household outgrew the tank, or the unit sits somewhere a failure would be expensive — an interior closet or above finished floor — and there is a better position available.
Trade-off: Solves a problem the old unit had rather than only replacing it. Resizing has to respect what the supply and vent can carry, and relocating means new pipe runs, new venting, and a drain arrangement at the new position.
Tankless
Fits when: Hot water demand is spread through the day, the space the tank occupies is worth reclaiming, and the gas supply and venting can be brought up to what the unit needs.
Trade-off: Heats on demand, so there is no stored volume to run out and no tank standing by to fail. The honest caveats: a gas tankless typically needs a larger gas line and its own venting, so the installation is a bigger piece of work than swapping a tank; simultaneous heavy demand is limited by flow rate rather than by tank size; and hard water makes descaling maintenance a real ongoing obligation rather than an optional one. It suits some households very well and is a poor fit for others.
Repair and keep it
Fits when: The failure is a part, the tank is sound, and the unit is doing its job otherwise — including when the unit is old.
Trade-off: By far the cheapest outcome and frequently the correct one. It is worth stating explicitly because "it is fifteen years old" gets used as a diagnosis when it is only context. What it does not do is buy certainty: a sound tank today is a sound tank today.