The earliest rails used "slab rails", made of a thin iron sheet nailed to a wooden rail. But this kind of rail is very low weight, so although the cost of construction is very low, but in the long run it is not good.
Later, after decades of improvement, the railways began to switch to rails and the quality of steel was greatly improved. The rails used on railways must be under great pressure and the use of very high quality steel is required. Railway rails have higher requirements for steel than other applications. The same minor flaws may not cause any problems in the steel bars used in the building, but the railway rails appear at any time causing the rails to break and derail the train.
Rails are not cheap, accounting for a significant part of the cost of railways.
The modern use of the rail section into a "work" zigzag, divided into the wheel contact with the rail head, the middle of the rail waist and the bottom of the rail. Different routes have different requirements for the strength, stability and wear resistance of the rail. So the rails also have different specifications. One route should be chosen to use that one, which requires consideration of economic and technical factors.