Rail vs railway
Solution 1:
It's partly geography, partly technology, partly era.
Historically, In the US, if the trains were pulled by steam or diesel locomotives, the enterprise was called a railroad. On the other hand most of the now defunct electric interurbans connecting cities were typically called "railways". That's a good rule of thumb, though there were exceptions. Though it's trains were pulled by steam and diesel locomotives, the Northern Pacific, which connected Minneapolis / St. Paul with the Pacific Northwest, used "railway" in its corporate name, while two of the last interurbans to operate, the Chicago, North Shore, and Milwaukee Railroad, and the Chicago, South Shore, and South Bend Railroad, used the name "Railroad" in their corporate names.
In the UK, most enterprises operating freight and passenger transport by rail used the name, and were referred to as "railways" to the extent that it's likely that a written article using the word "railway" was written in the UK, or by an author writing for a UK audience. The periodicals Model Railroader and Railroad Model Craftsman are published in the US for a US audience; Railway Modeller is published in the UK for a UK audience.
Present practice in the US would have little differentiation between "rail", "railroad", and "railway". "Railroad" would have a slight connotation of a locomotive powered freight or passenger train. Rail, especially if preceded by the word "light", would tend to refer to systems for passenger transport using cars with integral power units (that is, there is no identifiable locomotive). "Railway" could be substituted for either one of them.
Solution 2:
As attributive nouns, There's not usually much difference in meaning:
the rail / railway network
railway / rail transport
though rail is very likely the more common variant nowadays according to these Google Ngrams (which results agree with my own perceptions).
As mass / nearly mass nouns, the definite article is never used with 'rail':
the coming of the railway/s
the coming of rail
though again, the terms are 'largely synonymous', with the shorter variant of even the rather dated expression given above gaining popularity in recent years.
Of course, the words as originally (and for some time later) used were not interchangeable: rails were joined with fishplates, and railways built to compete with canals. Even today, 'Rail was built ...' doesn't sound acceptable.