Heat is not necessary, only appropriate pressure. In early railroad engineering, the curve was made by supporting the ends of a rail, using a lever in the center to force a bend in it, then hammering it so the iron rail retained its shape. Modern steel rail can be bent using a hydraulic bender, similar to a pipe bender, deforming the straight rail into the desired amount of curvature.
Simply,We all know its made from the factory but your main point is "How"
There are special types of patterns, And a railroad track is known as very dificult to make. It needs to stay strong on a soft surface, So the train can come and go easily without any accidents. If a nut or bolt is not pushed in propally, Then that is what causes the train to stop. Like Learning To Learn said, There are special panks of wood wich don't get made with the track. They are actually inserted first, And there for, The raildroad rails can be inserted on.
heard that they use some kind of rail bender machine which bends the heated rails and it can bend rails up to 180* or something like that
As You can see by the picture here there are planks of wood at a certain ammount of centimetre or degree angle.Theese pieces of planked wood help them to stop them from shaking and envolving passangers on the train or tram to get injured, hurt etc