An exhaust fastener lives through repeated heat cycles in a wet, salty environment. The nut and stud oxidise into one body, and the thread that used to be a clearance becomes an interference fit. The result is that turning the nut twists the stud instead of releasing it.
The stud is usually the weaker part in torsion, especially where it enters a cast flange. That is why the failure is almost always a snapped stud rather than a rounded nut, and why the first rule is to reduce the force the stud has to carry rather than to increase the force you apply.
Warm the nut and let the flange stay cooler. The nut expands away from the stud, the oxide layer cracks, and the thread gains back the clearance it lost. Heating the whole assembly evenly achieves nothing, because both parts grow together and the fit stays as tight as it was.
Apply heat evenly round the nut rather than in one spot, and give it a moment to work before the spanner goes on. A nut that is still expanding will fight the spanner; one that has been allowed to settle will usually turn.
Pulling steadily on a seized nut work-hardens the stud and loads it in the direction it is least able to take. Rocking is better: a small tightening movement first, then a release movement, repeated, so the oxide breaks in shear rather than in tension.
Use a breaker bar with a socket that fits properly, and keep the socket square. A nut that is being turned off-axis loads the stud in bending, and bending is what snaps the studs that would have survived pure torsion.
When the nut has rounded, or the flats have gone, stop turning it. A nut splitter or a thin cutting disc applied to one flat releases the preload without transmitting anything through the stud, and the stud survives to be cleaned up and reused.
Protect the flange while cutting. A disc that runs into the flange face scores a sealing surface that then needs machining, and a scored face will leak no matter how good the gasket is. Cut the nut, not the flange.
If the stud does break, the break usually happens flush with the flange, which is the worst place for it. A stud that stands proud can be gripped; one that is flush has to be drilled and extracted, and that work is done on the car, upside down, with limited access.
Before drilling, centre-punch the remains accurately and check that the drill is running true. A hole that wanders into the flange thread turns a simple extraction into a thread repair, and that is a different job with a different set of tools.
Replacement studs and nuts for a stainless exhaust system should be the same material family as the flange, so the pair expands at a similar rate on the next heat cycle. Mixing materials is how a joint that came apart once comes apart again.
Where the flange itself has been damaged, or the thread will not clean up, the repair is a welded one. A TIG welded repair can rebuild the flange face or replace the stud mounting, provided the area is cleaned back to sound metal first. Grinding to bright metal before welding is the step that decides whether the repair lasts.