Prior to the widespread use of ditch lights during the 1990s railroads had always relied on a single or double-bulb headlight for illumination (basically however the manufacturer designed and styled the casing); for diesels these were normally situated high at the ends of each hood or centered on the smokebox of steam locomotives (some steamers also had a pilot light on the rear tender that offered illumination for crewmen at night). When diesels began carrying low, short hoods the headlight was re-situated and centered near the top of this hood not unlike on a steamer. However it was placed on locomotives back then the light always provided sufficient illumination and it remained on nearly around the clock during the diesel era, except when the locomotive was not in service.
Interestingly, the railroad industry did utilize special lights to increase visibility years before the ditch light became mandatory. During the late 1930s Jerry Kennelly, a firefighter from Chicago, designed an oscillating light to catch the attention of motorists and bystanders to stay clear of an approaching train. What was known as the Mars Light, manufactured by his company the Mars Signal Light Company, the device normally consisted of two bulbs (either of the same or different color) rotating in a figure-eight pattern. The device, which was also applied to late era steam locomotives on some railroads, was normally found only in passenger service since people were trackside more often. Over the years Mars, and its competitors, produced several different variants of safety lights which had all but fell out of favor by the 1980s due to increased maintenance costs.
Through the early 1990s the design and function of locomotive's headlights changed little save for the FRA's requirements of candela output (a term that describes a unit of luminous intensity). In an effort to further improve safety for both the train crew and those trackside (motorists, pedestrians, or even railroad workers) the FRA finally made a change to the age-old practice of headlight usage (a device which had really been given little thought over the years by most except for the workers that maintained them). On March 6, 1996 the federal agency on safety and oversight of the railroad industry released a new rule stating that locomotives operating at speeds of greater than 20 mph that regularly passed through public grade crossings would be required to use ditch lights.
According to the FRA these auxiliary lights, which must burn at 200,000 candela, would be situated on the front and rear pilots of a locomotive to form a triangle and be placed at least 36 inches above the rail head; they would also be located either 36 inches or 60 inches apart from one another depending on the distance from the primary headlight. In one final added measure of safety the lights would be required to flash alternately "at least 40 intervals per minute and no more than 180 intervals per minute." The FRA's requirements for the new lights were quite strict stating that they must be activated any time a locomotive was in motion and if a bulb was burned out or not functioning it must be replaced as soon as possible. Railroads were given a little over a year to implement the lights on all locomotives and a date of December 31, 1997 was set as the time in which to do so.
There were few exceptions with the new rule but one notable exemption stated that any locomotive manufactured prior to December 31, 1948 and not used in regular commuter or intercity passenger service would be deemed historic equipment and thus not required to be equipped with the lights. As such, virtually no steam locomotives operating today carry the equipment and most classic diesels found pulling excursions also do not operate the lights. However, you can find them in use on early Electro-Motive cab models either operated by Class Is (for their business trains) or a few tourist lines. Of note is the Norfolk Southern's fleet of restored F units pulling its Office Car Special (OCS). When the locomotives were overhauled shop forces countersunk the ditch lights into the nose giving them a very nice, clean, and finished appearance.
Depending on your interest level of locomotives, and diesels in particular, a few books on the subject which may be of interest include Mike Schafer’s Vintage Diesel Locomotives and J. Parker Lamb's Evolution Of The American Diesel Locomotive. As the title suggests Mr. Lamb's book provides a general history of the diesel through the years. In the case of Mr. Schafer's book, it is not particularly long (less than 100 pages) but it is nevertheless pretty interesting! His title provides a quick look at several classic diesel models from early Electro-Motive products to venerable designs by Baldwin, Fairbanks Morse, and the American Locomotive (Alco).