Outside the Train
Begin your maintenance by turning the train upside down to access the wheels and examine them for accumulated dirt. Thick layers of dirt and grime can be removed with the blade of a sharp hobby knife. Once most of the dirt has been removed, use a pencil eraser to rub away the residue. Clean until you reach the bare metal and plastic of the wheels.
Turn the power off before doing any maintenance work on the track. Use sandpaper or a non-metallic kitchen scouring pad to remove any rust from the track. The track connections should have three steel connecting pins. Replace any missing pins and if a pin is loose in its setting, use a set of needle-nosed pliers to crimp the track surrounding the pin to hold it in place. Minor areas of dirt and grime can be removed using an eraser. You should also dust your track using a soft cloth on a regular occasion.
Inside the Train
Take off the cover of your locomotive by removing any screws holding it in place. For steam engines a screw is often located beneath the smokestack. To get the cover off other engine types, pull the sides of the body away from the train to release the locking mechanism, then pull the body upwards.
Apply a small bit of lubricant oil, such as WD-40, to the moving parts inside the locomotive. Only a drop or two is generally required, just enough so the parts can be moved smoothly by hand. Too much oil could cause the parts to slip when friction is needed and the train will begin to run erratically. If this happens, take a clean cloth and wipe away some of the oil, then move the parts by hand to layer the remaining oil evenly before running the train again.
If old oil has hardened onto the internal parts of your locomotive, clean it carefully using a toothbrush, dish detergent and water, and rinse afterwards. After cleaning the internal parts, coat them with a thin oil to prevent rusting.
When oiling the parts, check for dust accumulation. Remove all signs of dust, working carefully to prevent damaging the engine, and then lubricate. After the cleaning is completed replace the train body and run the locomotive as normal.