Question: What is the literal meaning of "auf der Strecke bleiben"? What is the link between the literal meaning and the meaning "to fall by the wayside"?

Answer: 
My first idea has been that the expression is related to the retreat of Napoleon's Grande Armée from Russia (or similar events), when many soldiers died of physical exhaustion, wounds, cold or whatever reason on the side of the road. It seems that this explanation isn't correct, though.

Instead the expression comes from hunting. *Jemanden zur Strecke bringen* and *auf der Strecke bleiben* share the same origin ([redensarten.net](https://www.redensarten.net/zur-strecke-bringen/)):

> 
> Etwas zur Strecke bringen im wörtlichen Sinn seit langer Zeit vor allem Jäger, und zwar nach erfolgreicher Jagd das geschossene Wild. Das wird bei größeren Jagden mit mehreren Beteiligten an einen Sammelplatz fein säuberlich in Reih und Glied, sortiert nach Art und Größe, ausgelegt. Diese Aufreihung nennt der Waidmann Strecke. Dabei kann man Strecke von „strecken, gestreckt“ herleiten, weil die Jagdbeute wortwörtlich alle viere von sich streckt, nachdem sie tödlich getroffen wurde.
> 
> 
> 

The "Strecke" is a place to which hunters bring the animals which they have shot.

P.S.: I hadn't read all answers before I wrote my own. @ChristianGeiselmann had already given a similar explanation. ~~However, *Strecke* is not a quantity - but a place.~~ *Jagdstrecke* or short *Strecke* can also be used to designate the total number of animals shot during a hunt.

P.P.S.: If you want to see a "Strecke", you can use the Google image search for "Strecke Jagd". Most images are not released under a licence, which would allow to use them here. The photo below shows the "Strecke" of a driven hunt on hares. As seeing such a number of animal cadavres may provoke a strong negative reaction, I use spoiler tags.

> 
>  [![image](https://i.stack.imgur.com/v8Vgd.jpg)](https://i.stack.imgur.com/v8Vgd.jpg) Image from: [common.wikimedia.com](https://commons.wikimedia.org/wiki/File:Drijfjacht_Strecke_Hazen_PM10.jpg)
> 
> 
>
Other than other people who answered here, I suppose that *Auf der Strecke bleiben* is not at all related to *Strecke* as *track* or *route*. Rather I suppose the phrase refers to an expression common with hunters. For them, by tradition since mediaeval times, *Strecke* is the quantity of animals caught and killed during the hunt, and displayed at the end of the event in a neatly arranged row somewhere on a meadow. Imagine hunters playing some music on horns in addition. 

One could debate, perhaps, if *Strecke* first meant the entirety of killed animals, or the place to display them. I have no opinion here. In any way, today both meanings are in use metonymically. 

Note that *killing someobody* is also

> 
> jemanden zur Strecke bringen
> 
> 
> 

which definitely is not related to *getting somebody to the route*. It is *getting somebody to be on display for successfully being hunted down and killed*. 

Admittedly *Duden Herkunftswörterbuch* (one of the more recent editions) claims that *Auf der Strecke bleiben* "probably" roots in sports, whereas *zur Strecke bringen* was related to hunting. But Duden does not give any evidence for this whatsoever, and I would dare doubting their judgement in this case. Rather than the relatively modern phenomenon of sports, a military context could be theoretically supposed, as Volker Landgraf did in his separate answer, with military men being left "on the track" during quick advance or retreat of larger military bodies. However, if that was the origin of the phrase, I would suuppose there were other words too like *auf dem Marsch bleiben*, which however does not exist. Contrary to that the existence of a phrase *zur Strecke bringen* which clearly is related to hunting, is a strong hint that also *auf der Strecke bleiben* is probably a hunting term.