That's true ("ability to operate") but another large factor (for scientific space missions) is the demonstrable benefit to continuing -- even if the spacecraft is fully operable. For instance, New Horizons, once it flew by Pluto, had accomplished its primary science mission, and an end could have been declared at that time.
But then the NH science team put together a rationale for an "extended mission" with the new objective of visiting a Kuiper Belt Object, which was accepted by NASA.
But on the other hand, at the same time, the Dawn spacecraft's proposed extended mission to leave Ceres and visit Adeona, was denied, and it is expected to just orbit Ceres for the rest of its lifetime. (More: http://spaceflightnow.com/2016/07/02/pluto-probes-extended-m...)
So the surplus lifetime might not be used if the further science benefit can't be justified -- against engineering effort, downlink, etc. Sometimes portions of a spacecraft are turned off but the low-bandwidth observations are still taken and downlinked.
Or, sometimes a spacecraft is kept operating, with great engineering effort, even though it is not in great shape.