Yeah, they do wash them occasionally. A really big terminal like North Platte will wash their locos.
The small railroads tend to take better care in that respect. On non-union railroads, workers can be used for things like that during slow times. I have washed many a locomotive. A hot water pressure washer is used.
The loco is first sprayed with a high-powered de-greaser. Then it is pressure sprayed with hot water.
I think it helps promote a positive attitude among the employees if the power is kept clean. Sometimes, you see locos whose only clean spot is where the crew wipes an area clean with their shoulders going in and out the cab door!
I've also seen locos so dirty you get dirty just walking near them (especially units used to switch carbon black plants). I once mentioned this to a friend of mine who was a retired chemical engineer. He said, "That's not filth! It's carbon, the same stuff we are made of!"
Dirty cabs have always been a pet peeve of mine. I don't live in a rat's nest. Why work in one? The worst messes I have seen are on coal train locos that I have taken for delivery to power plants. Especially the "comfort cab" models, left with windows closed on a hot day. A molding bag of garbage quicky makes the whole cab smell like a garbage truck. Many times I've had to take garbage out of cabs before the unit was fit to work in.
In addition to the messes already mentioned, I've seen cabs with the floors littered with sunflower seed shells.
Les