A railway works largely on the principle of "See and be Seen". In the daytime, a driver can see where he is and observe the signals. People on or about the running lines, provided they keep a lookout, are aware of approaching trains and can ensure they are in a place of safety. But at night, it's not so simple. On roads, we're now accustomed to widespread artificial street lighting supplemented by powerful headlights on vehicles. On the early railways, this was not the case. Various schemes were tried out using a flaming fire brazier at the front of the train (to warn of the trains approach) or at the rear (to act as a warning to a following train).
The Tail Lamp
The red Tail Lamp established itself as the 'last line of defence' for a slow-moving or stopped train to warn a following train. Considerable effort was put into making these oil lamps reliable and visible. Although the actual flame used was small, when combined with glass 'bull-eye' or, more recently, cast glass 'Fresnel' lens, in good conditions these could be seen from a considerable distance. There's a little more in the post MIC - Lamps.
View of rear of passenger train on arrival at Shackerstone on the Battlefield Line, viewed from a second train waiting to leave. The oil tail lamp confirms that the train has arrived complete.
Traditional Railways in Britain
In general, railways in Britain are fenced so, in theory, members of the public are excluded and there is less need for a bright headlight to warn people of the approach of the train. Although locomotives typically carried white headcode lamps which could be set in different patterns, these were provided purely so that signalmen could confirm the type of train approaching both by day and at night.
'Cumbria' (with headlamp lit) ready to return from Shenton. The single lamp near the chimney indicates an 'Ordinary Passenger Train'
At night, drivers faced blackness ahead, scanning the dark for the all-important signal indications. To preserve the driver's all-important 'night vision' there was little illumination on a steam locomotive footplate. It was normally restricted to a 'Gauge Lamp' which used rape seed oil (which is less flammable than paraffin) so that the fireman could confirm the boiler water level in the Gauge Glasses. Some locomotives were provided with a shield a shield between the firedoors and the driver's position to protect the driver from the glare when the firedoors were opened during firing. The driver had to orient himself by careful observation of his surroundings. Sound became important and drivers would know where they were from the sounds made by bridges, cuttings and other lineside features.
As railways developed, so did railway signalling to regulate the movement of trains. This evolution is briefly described here. Fixed signals were initially semaphore, as described in another signalling post here. At night, the indication was made visible by movement of the signal arm placing different coloured filters in front of the light from a small oil lamp, as described in the post Railway Signalling in Britain: Part 4 - Semaphore Signal Aspects by Night.
To enhance the visibility of signal indications further, methods of electrically illuminating signals were developed, resulting in Colour Light Signals where the semaphore arm (and moving parts) are eliminated and, by day and by night, the indication is given by various combinations of powerful coloured and white lights.
Modern Railways in Britain
Whilst less important routes in Britain still retain semaphore signalling, colour light signals are becoming universal. More recently, colour light signals using filamentary lamps are being replaced by multi-element Light Emitting Diode designs providing enhanced light outputs with greater efficiency. Most preserved railways (where speeds are generally moderate) continue to use mainly semaphore signals.
On the national railway network, oil tail lamps have been replaced by portable flashing battery-operated lamps using Light Emitting Diodes or, on multiple unit stock, built-in electric lights. With few signal boxes to observe the headcode of an approaching train, electric 'marker lights' are now provided at the front, together with one high-intensity white light to provide a warning to staff working on or about the line. This high-intensity light does give the driver some forward visibility at night but it mainly serves to improve the sighting of the various types of lineside reflective signs provided for the driver's guidance.
Many overseas countries had unfenced railways, increasing the chances of members of the public being on the tracks at night so there was more need for bright headlights to act as a warning. I found a summary of the American experience in 'Presentation Magazine' at The History of the Railway Locomotive Headlamp.
Electrical Systems on Steam Locomotives
The use of electricity could increase the brightness of locomotive headlamps and offered more convenience over oil lamps which needed filling and trimming regularly. Some electric generators were introduced on steam locomotives in Britain but their use was far more widespread overseas, as described in the post Electrical Systems on Steam Locomotives.
[Reference to post 'Electrical Systems on Steam Locomotives' added: 14-Sep-2016]