How to list entities and sort them by delta?
I think you're overcomplicating things here. From my reading, you really should be creating your view to:
Show content of type: Railway
This will be your &quot;grouping&quot;. You don't want to using the Views grouping option here - that option is more useful when you want to group the result content by a field on each result, i.e. if your stations node type had a reference to Railways.
Fields to Display: Title, field_stations (or, preferable imo, configure a view mode for the Railway node that displays the fields you want to show).
Since we have a view of Railways, your results are naturally &quot;grouped&quot; by Railway. If you just display the stations field from the railway, you'll get the stations listed in the order on the field (its delta).
(optional) Contextual Filter: field_stations
I'm not sure if you actually need this from your description. You can configure a contextual filter for the field_stations field to allow you to show only the Railways (and their stations) if a Railway references a station you pass as an argument.