Probably because of all the history classes we all took in grades 1 through 12, many people have a impression of the railroads that comes from the 1800s. We imagine hundreds or thousands of men building railroad tracks using hand-carried wooden railroad ties and hammers. Something like this:
The following video has made the rounds since it was released, with well over half a million views. It is fascinating in a "How It's Made" sense, because it shows an amazing amount of automation now used in the process:
The only problem is the lack of an explanation of what is going on. Each machine is accomplishing a specific task. At the beginning some of these tasks are pretty obvious, like the machines that fetch concrete ties and then lay them on the track. But what, for example, is this machine doing?
This is a tamping machine, designed to pack the ballast (gravel) around the ties, in this case made by Plasser & Theurer:
What is the following machine doing?
It is a ballast cleaner. It removes all of the ballast, in this case to lay geogrid fabric underneath. But the main reason for pulling out the ballast like this is to clean it. As the track ages, the ballast gets crushed. The ballast cleaner runs the ballast through a screen to remove all the small pieces (and sand) and replace them with correctly sized ballast.
For more information on the track-laying process, this documentary can be helpful: