First, when it happens again, stop everything you are doing, reach for the nearest multimeter, and meter the rails under and in front/behind the locomotive. Try to do this without putting much pressure on the tips of the probes. You don't want to impart a moment to the rails that might hide the problem by temporarily restoring continuity when it may actually be broken at the rails.
If you get a voltage reading, and all seems peachy, then you know it is something to do with what is on the rails, and not with the rails themselves. Now you must look to a feature that causes the break in continuity. It might be a high frog that causes the whole engine frame to develop a cant sufficient to actually lift a contact wheel off the rails. Or, the whole turnout may be warped and effectively accomplish the same thing with an otherwise perfect frog. Or there may be a problem with wipers on the loco. Is it a steamer? DCC with sound? Is the tether fully seated right to the furthest reach of its receptacle?
If the loco seems good, especially everywhere else on your layout, and only this one turnout, with several of the same kind in use nearby, is the apparent trouble spot, you have two possibilities...a defect contact set in the turnout if it is power-routing, or the joiners on either end of the turnout are not making proper contact.
The joiner problem has two possibilities, in turn. One is crude, oxidation, or something else impeding continuity, or the turnout is allowed to rock or sag when the heavy engine runs over it due to improper roadbed construction and support. The rocking over time can splay the joiners and eventually cause one or more of them to simply stop making contact.
Before I forget, one simple diagnostic for turnouts and any length of track where an engine seems to stall is to place a wooden dowel or some object over the rails here and there and press down or lift up. If the engine springs back to life, you know you have a continuity problem in the rails, and probably a joiner or a broken contact with a feeder wire at that location.
-Crandell
Try running 2 locomotives about 2 feet apart. When one stalls does the other loco stop at the same time or keep going? What brand and type of Loco' s are you using?
Springfield PA
What kind of turnouts are causing the problems? And, are all the turnouts of this type causing stalling, or just some of them?
Atlas makes both "Custom Line" and "Snap-Switch" turnouts. The snap-switches have tighter curves and generally smaller frog numbers. The frogs are plastic, and the turnouts have jumpers underneath that route power through both routes regardless of position of the points.
Custom Line turnouts, on the other hand, have a metal frog. It's black, like the plastic ones, so some don't even notice that it's actually metal. Since the frog is longer, the wheels have more chance to be on the frog. The important thing to remember about these is that the frog, even though it's metal, is not powered. So, it's a dead zone, and wheels are getting no power there.
You can power the frog. However, it needs to have the power switched to the appropriate polarity based on the position of the points. This requires either a relay or a switch machine with built-in contacts. Atlas makes both products, or you could use a Tortoise switch machine which comes with the contacts as part of the machine.
It takes an iron man to play with a toy iron horse.