Look for corrosion, bends, breaks and missing clips or pins. Take a look at the lockon or terminal, to see if it is in good shape. If you have an electric train made between 1920 and the present, you can find replacement track. You need lubricant and oil. The lube is a thick grease applied to gears and the piston joints on steam locos.
Oil is used on pivoting pins and the point where wheels touch the inside of trucks.
Use a mild cleaner to wipe away dirt and grime. A damp cloth can remove a host of ills. Wipe your train clean. If in doubt, ask those who specialize in the type of trains you have. There is a tendency for all trains to spark when contact wheels hit a gap in the rails.