firstly, only military ships have that problem. (which means that if you manage to build commercial ships, with commercial engines, you will NEVER face maintenance)
concerning thus only the military:
1)maintenance modules increase the maintenance parts you can have on a ship
2)engineering bays increase the life "span" of ships.
when years passes, military ships will start "losing pieces" (activate events-log to see) and start being repaired on board, losing maintenance parts. if they lose the engines, and have NO spare part, they "go to a crawl" because their engines are broken.
so, basically, you select a ship and order her:
1) resupply at colony (if maintenance parts are low)
2) Overhaul at colony (if X years have passed, were X stands for the time when they start to break up exponentially)
you can keep from overhaulign them for a while, even when they break, but at a certain point they will break once per month or more, and remain without parts FAST...so, overhaul them at colony. >.>