Does having the engine pushing at the rear of a steep railway have any mechanical advantage over an engine pulling from the front? After recently visiting a mountain railway, some friends and I were told the engine pushed the carriages up the mountain from the rear and also remained in the same position leading them back down the mountain.
It was supposed that this was to prevent carriages running away when ascending or descending, but one friend suggested that a mechanical advantage may be gained by having the engine in this 'lower' position rather than the higher. His postulation is that the engine would experience a greater downwards force (weight) and therefore more friction (/bite) between the rails and the track, thus making the engine more efficient, allowing it to exert more force on the carriages with less energy wasted in slippage.



Engines in different positions
I thought about the force acting on a single wheel on a slope, and I believe it's resolved as:
$$F_\mathrm{normal}=\mathrm{mass} \cdot 9.81 \: \mathrm {N\:kg}^{-1} \cdot \cos (\theta)$$



To me the mass is constant and the weight will not increase. More force acting on the front of the engine in the $x$ direction would not increase the weight and therefore would not increase the force in the $y$ direction and there would be no increase in friction between the engine's wheels and the rails.
Is there any way the lower position could have any advantage?
Note: The discussion is purely theoretical since it turned out the railway operated on a cog and rack system :)
Having read the input from HsMjstyMstdn and Floris, it appears that (depending on a rigid coupling) a downwards force would be applied by a carriage that would counteract the torque that $could$ lift the wheels of the engine, and reduce friction. Is this equal in both push and pull cases, or could the position mean one is less likely to 'lift' and less likely to slip?
Also, how would one refer to this downwards force? I feel like it's not weight, but it is acting in the same direction.
 A: Great question. I'm surprised that upon searching, I haven't come across a train-push vs pull question in Physics SE. I'll try to give a detailed answer.
TLDR; Conceptually, the pulling engine is better but both push and pull trains are doable and exist in real life. If you're talking about an idealised thought experiment, I don't think there's a difference.

Now, let's talk details. Your force reasonings are accurate in that, you do no more work pulling a weight up a hill than you do pushing it. The normal/reaction force that is relevant to the friction experienced is perpendicular to the push/pull force and as such, cannot contribute to friction's magnitude. However, it doesn't really matter since train wheels almost never slip. Of course, there is the occasional slip where ice, grease, organic matter, etc. are concerned but steel on steel with heavy weight makes for some impressive tractive force. See this question for more details.
In real life, many train companies use both push and pull methods. In a push-pull train, you have dual locomotives in the front and back, sometimes working together, sometimes taking turns. Companies also do pull trains one way and then push them back, saving cost and having to turn the train around. If we're talking pull-only vs push-only trains, it's a different story.
Theoretically, no, the engine pushing at the rear will not have any mechanical advantage over the engine pulling from the front. In fact, it is the other way around. For many reasons, I think the engine pulling has the advantage, however small.

*

*Easier to see
For one, it is easier and safer to get where you're going when you place your sensors in such a way that the information relevant to your motion reaches you soonest. Almost always, this is the part furthest along the direction of your motion (which is why most animals have their eyes in front). In other words, you get to see what's in front of you before you hit it.


*Easier to make
Secondly, a train that has a pulling engine is much easier to design and build. Most train cars are connected by a "tether" of sorts, which is much closer to a string than it is to a stick. It is a lot easier to design and build connections that are strings that pull cars than sticks that push cars. What I mean by stick is something which is rigid and resists deformation. What I mean by string, however, is something which pulls and is pliable. An interesting aside, I've heard my professor once say that that's sort of the definition of a string in physics; something which can only pull and not push.
Anyway, in real life the train cars don't do well when they are pushed with a string (even a semi-rigid connection). You get collapses and distortions in the overall chain of the train because the connections can't withstand the force intended to push the train. The tracks help mitigate this to some degree but it creates unwanted stress.



*Easier to steer/safer to drive
It only makes sense to push the train if the connections are rigid but then steering the train becomes mechanically harder because the train becomes less flexible as a whole. The chances of derailing are also higher in a push-train than it is in a pull-train although I am aware some experts say that the difference is small enough to be ignored and isn't significant (especially in reference to Glendale 2005 and Oxnard 2015). I think this is because the direction of force is changing sooner with respect to the direction of track change in a pull-train than it is in a push-train. In other words, the pull force changes with the curve and the other cars follow accordingly but the push force remains straight as the cars in front experience the curve in tracks.


*More efficient design
You also get inefficiencies when you push a non-rigid train because all the small things in a train distort whenever and however they can. Forces and these things in general tend to always take the path of least resistance. A path that is non-rigid is by definition less resistant than a rigid one and so whenever a non-rigid path exists and is pushed, it will bend and buckle in a way that it was not designed to do. This creates more friction, wear, tear, heat, noise and in general, more things to account for. Below is just one of the ways I could think of that a push-train going uphill could go awry.

Additionally, a pull-engine has an inherent superiority to a push-engine. Try this; slowly push a cup with your finger across the table. Eventually, you will "lose" the cup. It might slide to the side or be pushed aside by your finger or twist to avoid your finger. Now try pulling the same cup with your finger through its handle. You'll never lose the cup. Not sure how significant this is when there are tracks but I imagine there's certainly a difference.
Idealistically in a thought experiment, I think there is no difference. You'd need some kind of exotic material though, along with perfect rigidity, perfect trains with perfect connections, flawless tracks, etc.
Edit
In response to the updated question, with a rigid coupling, both the pull and push engines have things resisting the torque "lift" of the train (weight of front load in push-engine and the back portion pushing into the ground in pull-engine). Note that whether the locomotive is front-wheel, rear-wheel or all-wheel drive is relevant. That being said, I still maintain that the pull-engine is superior because the point here is essentially that the train is doing a power wheelie. The best way to mitigate wheelies isn't by moving more weight to the front of the vehicle, it's by adding a wheelie bar.
A: The picture in HsMjstyMstdn's answer gave me a thought (although I believe this is not what the picture was attempting to show...):
When a locomotive pushes a heavy train up a slope, it will be required to generate lots of torque with the driving wheels.
Now when you are pulling, applying a lot of torque might make the front of your locomotive lift up (think drag racing cars). But if you are pushing, the front of the locomotive is actually held down by the weight of the car it is pushing.

I think that is sufficient reason for putting at least one wagon in front of the locomotive - but since it would be inconvenient to have the engine in the middle of the train it makes sense to put it at the downhill position.
