Inspect carefully to see if something is tilting the track in the area where derailments occur? Any abrupt changes in the angle of the track can cause derailments.
Also check to see if there is something on the track level that is striking the train and causing the derailment?
A flashlight will come in handy when examining the track.
Look vertically down on the track and horizontally across the track. If you find even a small amount of debris, carpet fuzz, pet hair, floor dirt, or dust… then, clean the track. Surprisingly, small bits of debris are big enough to be the culprits, particularly with N and Z scale trains.