Why are trains modernised?

A train can be modernised many times during its lifetime. Modernising a train helps
to extend its lifetime (by 15 to 20 years) or add new functions.
The modernisation can have different objectives:

Why are trains modernised?