They will clear away debris, snow and other obstructions. They will regrind rail. They will spray roadbed to eliminate foliage. No, real railroads do not send cars out to wash down the rails. Clean track is an issue for toy and model trains, since current passes through rails to the wheels and center-rail pickups.
Dirty track can break the flow of current, creating a barrier between rail and wheels.
The toy and model train folks have to keep their track clean. Enter the track cleaning car, a staple of the model pike that has no re4al-world counterpart. Marx joined in by making a track cleaner based on its work caboose. Since then, track cleaners have appeared in all gauges. Some are designed to look like a special car, others are disguised and something else, and a few don't look like anything you might see on any railroad.