Repair or Replace, Without Guessing

Homeowners usually frame this as a money question, and it is, but not in the way it first appears. The cheaper invoice today is frequently the more expensive decision across the period you plan to own the house. The useful version of the question is narrower: how much service life is left in what I have, and is the thing that failed the actual problem or a symptom of something upstream.
The first obstacle is usually narrower than the decision itself: knowing which trade owns the problem at all. Comparison resources such as homeservicetimes.com are a reasonable place to work out who to call before you start booking assessments.
Start With Remaining Service Life

Most building components have a reasonably well understood lifespan, and the number that matters is not how old the thing is but how much of that span is left. A water heater at year eleven of a twelve year expectancy is not a repair candidate no matter how small the current fault is, because you are buying a few months at the cost of a service call that will be repeated. The same component at year four almost always is.
The awkward middle is where judgment lives. At roughly two thirds of expected life, a repair that costs a meaningful fraction of replacement is usually the wrong trade. Below that threshold, repair generally wins. This is not a formula so much as a way of forcing the conversation onto the right axis.
Distinguish the Failure From Its Cause

The most expensive mistakes come from repairing symptoms. A ceiling stain repaired without finding the source will reappear, and the second repair now includes remediating whatever kept getting wet in the interim. A door that will not latch is sometimes a hinge problem and sometimes the house telling you the framing has moved. A cracked tile can be a cracked tile or it can be deflection in the subfloor that will crack the replacement too.
The diagnostic question is simple to ask and revealing to hear answered: why did this fail. A contractor who can explain the mechanism is proposing a repair. One who cannot is proposing a patch, which may still be the right call, but you should know which one you are buying.
Where Replacement Wins on Non-Financial Grounds
Some replacements are justified by things that never appear in a cost comparison. Parts availability for discontinued equipment turns every future failure into a scavenger hunt. Components that are difficult to access, buried behind finished work or in a crawlspace, carry a labor premium on every visit that makes repeated repairs quietly costly. And anything that has already been repaired twice is telling you something the arithmetic will not.