The train engines are not always in the front. They can be at middle and end also. The three possibilities are..
- At front (Normal Express Trains)
- Front, Middle and End (EMU and DEMU)
- Front and Back (Hill trains)
Trains with front engines:

These are normal express trains daily we see. It works on basic principle that we learnt in school physics. Pulling is easier than pushing. To save energy and safety issues, engines are at front for this type of trains.
For example: We pull a luggage trolley but not push.

Front, Middle and End (EMU and DEMU):

EMU stands for Electric Multiple Units (D-Diesel in case of DEMU). These types of trains have engines at front, Middle and End. Because these coaches are light weight.
What makes these coaches light weight?
- Absence of toilets and overhead tanks.
- Full aluminum body.
- 30% Door space.
- No heavy weight berths in the coaches.
In order to have quick pickup and save energy these coaches are made light weight.
Why do lighter trains should have multiple engines and made multiple units?
(Now you should have understood why they are called Electric Multiple Units)
The reason is centrifugal force.

Centrifugal force tends to push away when the train turn at high speed. This can derail the train.
If the engine is at front and turns a 90 degree turn at 100 KMPH, the centrifugal force pushes away the train and can lead to derailment. So these are broken to multiple units to reduce the effect of Centrifugal force.
(For Non Science people: Centrifugal force is the one which helps a boy to fell on a girl beside him while bus take a deep turn. If she is a science student, she will understand the effect of the force. If not, the boy will understand the side effect of the force)
Why the centrifugal force do not apply for normal express trains?
Look at the below image.

The seat used by the hero Bala Krishna is perpendicular to the roof. Where as the next seat, which is empty is moving away from the roof.
Here due to the weight, gravitational force dominates the centrifugal force. The normal trains weigh more and uses the gravity, which minimises the Centrifugal effect.
Hill trains:
For suppose you are with luggage trolley and climbing a hill. The gravity pulls back your trolley and you need to put extra efforts to pull the bag. Obviously you do not use the trolley and hold it with the hand.

Similarly a train moving uphill will be pushed by the engine upwards from back and help the pulling engine.