Quick answer
Those locomotives are often Distributed Power Units (DPUs). They are remotely controlled from the lead locomotive and help distribute pulling and braking forces along a long freight train.
Less stress through the train
Concentrating all pulling force at the front can create high draft forces through couplers and draft gear. Properly placed distributed power reduces both pulling and pushing forces within a long train.
Better braking and air supply
Distributed locomotives can contribute dynamic braking and additional air-compressor capacity. This can improve brake-pipe charging and train handling.
Is there an engineer in the middle locomotive?
Normally a DPU is remotely controlled from the lead locomotive. Seeing an engine in the middle does not mean another engineer is necessarily riding in it.
Keep exploring
Still curious?
Ask Ask the Conductor a railroad question in your own words.
Ask the Conductor