The Making, Shaping and Treating of Steel, 9th Edn., has a chapter ‘Railroad-Rail and Rail-Joint Bar Production.’ This includes information on straightening rails, which is done cold using heavy presses. A pair of presses, each having dies sloped to a straight centerline, plus support rollers on each side, is used.
Regarding the metallurgy and effects of heating. For rail weighing 91-120 lbs/yard, a representative composition is 0.67-0.80% C, 0.70-1.00% Mn. 0.04% P (max) and 0.10-0.23% Si. After hot rolling, a controlled cooling is used to prevent shatter cracks. The rails are allowed to cool under 1000oF, then placed inside insulated chambers. The controlled cooling between 725 and 300oF (a minimum of 7 hours is required before reaching 300oF) allows formation of a tough, strong, pearlitic microstructure.
Hardening of the top and wear edge, primarily for rail used in heavy wear regions such as curves, can be accomplished by heating with either an inverted U-shaped induction coil or gas burners, followed by compressed air quenching. Residual heat results in tempering to a Brinell hardness between 321 and 388. Hardening of the rail web or base is undesirable.
Although this information refers to 30+ years old U.S. practices, I would not expect significant functional differences. Without either the specific heavy equipment for cold straightening or for controlled cooling after hot working, I would strongly advise against straightening rails. Straightening by a manufacturer is a possibility, although less feasible if the rail has been partially hardened