During the work on a maintenance site, the rails are brought to the site in fixed lengths (usually 30, 60 or 120 m). They are temporarily connected with fishplates and checked and then laid on site. The temporary connection between the rails is removed after the correct track geometry has been produced and replaced by a permanent rail connection. Originally, fishplated joints were used, but today, it is usual to weld rails together to form long welded rails. This welding creates continuous welded track with integrated continuous driving mirror and reduces the stress and the noise emission of the overall system considerably. The resulting "infinitely long" (long welded) track poses great technical challenges, both in terms of the quality of the welding and with regard to the modified physical behaviour of the complete system (e.g. due to temperature fluctuations).
Closure welds of the rails can generally be done with filler material (alumino-thermal casting fusion welding (Thermit weld) and electric arc welding) or without welding fillers (flash-butt welding and gas pressure welding). Depending on the process, new material is introduced or existing rail material is used.
Flash-butt welding 
In flash-butt welding the rail steel is brought to the welding temperature by the use of the electrical voltage. An arc is produced at the free ends by the current applied on both rail ends. The high energy input warms the rail ends, and as soon as the desired melting temperature is reached, they are pressed together under high pressure (upset stroke). After trimming off the protruding material a welded connection without any foreign material remains with a minimal heat affected zone.
Gas pressure welding 
Like flash butt welding, gas pressure welding, which is mainly used in Japan, requires no specified welding gap. Before welding the rail ends are ground flat, any impurities (e.g. rust) removed, and they are exactly aligned. While both rail ends are constantly pressed together, a constant oxygen-acetylene flame heats the mating faces to 1,200 to 1,300°C. The connection created in this procedure is not done by a melting process, but by a combined recrystallisation and plastic deformation.
Thermit welding 
The inventor of the Thermit welding process was Hans Goldschmidt. He discovered the process by which it is possible, via a chemical reaction initiated with a firing stick, to obtain steel and slag from a defined powder mixture (Fe2O3 and 2 Al). The rails are aligned with one another before welding and, depending on the ratio of the neutral temperature to the rail surface temperature a gap between the rails is produced in the closure weld. After installing and filling of the prefabricated sand mould the reaction is started and the gap filled with the resulting steel. The reaction in the welding crucible is started with an ignition rod. Within a few seconds the material reaches temperatures of 2,500 to 3,000°C.
In addition to traditional welding, the build-up welding is a second classic method of welding. It is mainly used in turnouts, in the area of the common crossing to re-establish the rail surface. Even with large rail surface defects (wheel burns or squats), build-up welding can be used as a temporary measure to ensure smooth running and safe railway operation.
Manual arc welding with stick electrodes or inert gas welding with self-protective filling wire electrode are used on tracks in Austria, Germany and Switzerland. Arc welding is used on branch lines and to a certain extent for the closure weld of two rails. Due to the low welding gap this requires special skill on behalf of the welder. 
You can find suitable specialist literature to the topic here:
The Basic Principles of Mechanised Track Maintenance
This book is dedicated to the many people involved in the day to day planning and performance of track maintenance activities. Providing a practical approach to everyday challenges in mechanised track maintenance, it is not just intended as a theoretical approach to the track system.
Railways aim at transporting people and freight safely, rapidly, regularly, comfortably and on time from one place to another. This book is directed to track infrastructure departments contributing to the above objective by ensuring the track infrastructure’s reliability, availability, maintainability and safety – denoted by the acronym RAMS. Regular, effective and affordable track maintenance enable RAMS to be achieved.