A typical mainline diesel has a service life of about 15-20 years before a major rebuild is needed. This is an average only, since many diesels that are bad performers may be scrapped instead of rebuilt, while other diesels may be running around for years in as-built condition. Rebuilding generally includes renewing all wiring, overhauling major components, and may include some upgrading. A current consideration for rebuilding is that it is generally more cost efficient to purchase new locomotives for mainline service since that meet current pollution requirements and are more fuel efficient.
Periodic overhauls depend on the use and care, just like any other piece of machinery.