So can someone quickly explain for me what happens to electricity when there is a derailment.
Well, there's at least three possibilities:
- First (and all 'round best, if you desire to limit the potential mischief), a derailment can 'open' the previously connected circuit, and the electricity no longer flows from the source through the device being intentionally activated. Simply put, the train stops running, the lights go out, etc. Other than no longer getting the desired result, no damage done (unless your engine took a header off the edge! 😳).
- Second (and probably potentially the
most damaging), a derailment can cause a "short circuit", or "short" for, err, short, meaning that, instead of being routed by the intended path to and through the device being activated (and in the process using the electrical energy to activate that device), the derailment has insead created an alternate path for the electric current to flow, without having to do all that pesky 'work' in the process. Since the 'short' typically has a lower resistance to the electric potential (voltage), the resulting current flow can be
massively larger than the components are designed to handle, potentially putting every section of that circuit in jeopardy. One of the worst shorts I ever had was a trolley that derailed with the center rail pickup somehow short circuited across the track. The ZW's circuit breaker never popped, but the resulting current was sufficient to literally melt the pickup off the trolley, and char the length of the (in hindsight, much too small) track feeder wire, resulting in copious columns of smoke rising above and from below the layout! 😲
- Third (and the most quirky and hard to predict), a derailment can cause electricity to flow through unexpected paths, with unexpected results. In other words, a derailment can create unexpected connections and potential paths for the electricity to flow. Sometimes the results can be as bad as a dead short, but often the result is just puzzling or even not readily apparent.
For the third category, sometimes you don't even need an actual derailment -- for instance, to allow 'old school' activation of the crossing gate and bell at the dual track crossings on my layout, I used a separate power supply rather than track voltage to activate the crossing features through an insulated outer rail section on each track, relying on the rolling stock wheels on one track or the other to bridge the outer rails and provide a path to the common ground. Both crossings worked flawlessly . . . until trains on
both tracks arrived at the same crossing at the same time, in which case the five amp circuit breaker protecting one or the other of the circuits would immediately pop open, every time, stopping that train in its, err, tracks! I still haven't figured out what I did wrong (I suspect there's some back voltage from the two running engines feeding a differential voltage back into the common ground that's at fault, but so far I haven't had the time to run it to, err, ground, and just ended up temporarily disconnecting the second track activation wires).
sigh
Oh, and a fourth possibility: derailments (or even intermittent poor contact with the rails) can also create voltage spikes and other 'noise' in the electrical circuit, which can wreak havoc with any sensitive electronics connected to that circuit. Since I generally run post-war conventional equipment, that's of little personal concern or consequence to me, but if you
do rely on modern electronics for all the zoomy features built in to your rolling stock, you would be well advised to take measures to protect your investment!

