For long freight trains and those that will be climbing to stations at higher altitudes, an extra or two locomotives are attached to the front. I've always wondered why.
As usual there are multiple issues. Most important is landscape. If more power than a single locomotive can provide is not needed for the whole trip, but only a short stretch, like climbing or crossing a mountain range, then it would be a huge waste of resources to attach them the whole trip.
For example, take a 10 hour trip time, where all, except for a 1 hour stretch, can be pulled by a single engine. That stretch needs the power of 3 engines. Fitting a train with three engines would solve this, but occupy all 3 engines for the whole 10 hour trip time. More so two of them would only add weight to be pulled for most of the time.
By stationing two engines at the climb, a train can run on its sole engine up to the climb, get these two engines added in front, climb for one hour with three engines, after that, let the additional ones go and continue for the rest of the trip with just a single engine.
Sure, not a big saving when just looking at a single train per day, but what if there are 4 trains per day? To equip each with 3 engines the company would need 12 locomotives. In contrast, with stationing two engines at the climb, these 4 trains would only need one engine each, so with the two stationed ones, only half the number of engines need to be bought and maintained - that's quite a saving, isn't it?
And that brings us to adding to the front: it's simply the fastest and easiest way to add them. That can be done in minutes, while adding engines in the middle may easily take an hour of shunting.
Of course this only works with short-term power need and considerable train frequency. Routes that only feature very few trains (like some desert railroads in western Africa), or have their climbs not centralized will not benefit here. They have to run with multiple units all time.
Which brings reasons for placement:
On the other hand, if locomotives are placed after every 10 bogeys, then each is pulling 100 tons only.
Multiple points to think about
As already mentioned, it's least effort to put units in front, even if multiple units.
Grouping units upfront simplifies coordination, as control (electronics) can be wired up with a simple cable between these.
Units interspersed would need to be radio controlled (wiring along freight cars would be complex and expensive).
Radio links can be disturbed, less likely with cabling.
With distributed engines the calculation isn't as easy as mentioned, as an intermediate engine should never push wagons in front. As soon as an engine starts to push, the couplers will start to oscillate, introducing heavy wear. Thus any engine will only be able to cover for a fraction of wagons behind, so all coupling sections will always stay under force.
Distributed Power does reduce wear in curves, allows lighter (or less well maintained) ROW.
But most important of all, the pulling force a knuckle coupler can handle is way greater than anything a single locomotive can deliver. A Janney coupler, like used in heavy freight trains, is specified for 4,000 kN (Kilo Newton). That's way more than a reasonable sized locomotive can deliver. For example an EMD SD70 can deliver at maximum 850 kN. In other words four major engines at full power would still leave a safety margin >20%.
Bottom line, a train that can be pulled by two or three engines will be pulled upfront. Only if that limit gets exceeded will distributed power make sense. And it will be only inserted if used on the whole trip, or long parts thereof.
An exception thereof are dividing trains, that is trains running over some stretch along the same route, to be split up at an intermediate station, heading for different destinations. Joining them for the common section can save the need for a second crew.