Ok I need to quick say this: the media and non-rail working public has a vastly different idea of derailments than what actually happens.
Derailments happen ALL the time. The thing is, the average derailment is literally one wheel or axle set goes off the track and the train stops. In a few hours, a crane comes over, puts the car back on, and what mostly happens is the train gets back to moving if no serious damage is assessed. The Ohio derailment is the type everyone thinks of as a derailment, and they are in fact quite rare.
I'm saying this because I already can tell that now every time a derailment happens, people are going to freak out over what really isn't much. If an Ohio happens its very, very bad. But for most derailments, it barely causes an issue.
But these things happen a lot, either because of issues with the cars, which I can attest have not seen much repair or rebuffing in at least 20 years, managerial incompetence like making the trains too long and not following regulation because longer trains=less trains to move and more money up front, and frankly, accidents do happen, even if you do everything right.
We nearly had to pay a costumer when a rail cars brakes failed after delivery, causing damage, and had video evidence the brakes were set and we followed all the rules.