Fixing derailing model train cars and locomotives usually requires checking two things, the derailing cars and locomotives, and the track where they derail. If the problem appears to be the train, there are some simple steps you can take to locate and correct the problem.
Start with the wheels and the trucks. Are the wheels in gauge? This can be checked with a standards tool available through the National Model Railroad Association (NMRA). If not, wheels can usually be adjusted by gently twisting them around the axle. Metal wheels track better than plastic. Replacements can be found at hobby shops or online.
Do the wheels and trucks move smoothly? Wheels and axles may need cleaned. Screws attaching the trucks (wheel assemblies) to the carbody may need to be tightened or loosened. Both trucks should swivel freely, with one truck also being able to rock from side to side. A little light oil may be added where the axles ride in the trucks to provide a smoother ride.
Check the couplers. A low-hanging coupler can get stuck on switches and crossings. This can also be the cause of separating cars. Bad springs can keep couplers from staying closed or moving freely from side to side.
If the coupler is not the right height, it can usually be adjusted by tightening the screws which hold it to the body. You can also add small washers between the truck and the car to raise the entire car height if necessary.
If the wand or trip-pin (used on magnetic couplers for uncoupling) is low, it can usually be bent slightly upward with light pressure and a pair of needle-nose pliers. Special tools are available for this that make the work easier and more consistent.
If any of the springs which keep your coupler centered and closed are missing or damaged, replacement parts are available.
Add weight. A little bit of extra weight can help a lot. The NMRA has standards for every scale based on the length of the car. Most cars are a little light from the factory. Extra weight is easy to hide inside boxcars and the like; an interesting load works on open cars like gondolas and hoppers. When adding weight, try to keep the center of gravity as low as possible.
Is the train too big? Long cars and long trains don't track well on sharp curves, even if the track is well laid. Most manufacturers will list a minimum curve radius on the box if a model is designed for curves longer than what the typical train set provides. Free-rolling wheels, strong couplers and proper weight will help you run longer trains.