As with most problems, shorts can be attacked with a ‘divide and conquer” strategy.
I’m presuming plastic spoked wheels with insulated crankpins generally - if you’re using metal wheels, with hub insulation, the valve gear will be live and the cylinders/motion brackets will need insulation from the frames. Kapton tape, tufnol and nylon screws are your friends. Metal wheels with rim insulation are similar to plastic spoked.
you’ll see on French level crossings, “un train peut en cacher un autre” - similarly, one short can hide another, if you have multiple shorts, you have to find them all, and they do hide behind one another…
where does it fail?
does it fail on my track / everybody’s track? If the latter, assume it’s the loco, not the track.
does only this loco fail on my track / do all locos fail on my track? If the latter, look at the track wiring, not the loco.
does it always and only fail on left hand bends (or one particular left hand bend)? It’s an interaction between loco and track.
does it fail when coupled to tender / always? Split tender & loco, check to see if either fails individually, or only when coupled
does it fail when coupled to certain other stock? I had one of these to sort out last month. Brass stock with live body, brass loco with live body, coupled one way no bother, coupled the other, sparks from coupling chain and buffers. Avoid having live chassis unless the body, buffers and couplings are insulated! It was ok for Triang, and Hornby, but it’s not ok for finescale models of mixed parentage! And it’s a likely chip disaster if you fit DCC.
ok, so perhaps we are down to a loco that still intermittently shorts.
remove body. Does it still short? If so, it’s in the chassis, if not, it’s likely a wheel touching the footplate or a splasher
remove bogies & pony trucks. Does it still short?
check resistance between rails and loco chassis. If chassis is live to one or other rail, fix that first.
repeat, but now slide wheels across to extremes of free play, both ways.
fit insulating spacer washers between wheels and chassis if wheels touching chassis.
If it still shorts try removing the valve gear & coupling rods.
disconnect the wires from the pickups to the motor so the pickups are not connected together.
Repeat sliding wheels from side to side
use a strip of paper to isolate the wheels on one axle from the rails, repeat for each axle, you should be able to identify whichever axle is touching.
hopefully this will identify 99% of issues.