Why do sand is sprayed on railway track by engine?

Almost everyone must travelled in train. It is the most common means of transport. Trains are used for moving both passengers and goods from one place to another. We all know that train is run by a rail engine. Do you know, apart from energy sources, the most important thing to run a train is sand?