In general, we stay alive for as long as there is something we need to (or ought to) accomplish - spiritually.
(So many modern people live so long mainly because they have chronically failed to accomplish even the basic minimum necessary during their mortal lives. They are kept alive in hope that - eventually - they will do what is required.)
What is this spiritual thing - that we ought to accomplish - varies between individuals; so one task of old age may be to discern what it is that we should be doing. Probably, since mortal life is 'about learning', this could translate to: 'What we still need to learn'.
Since an old person has always experienced a lot; this purpose is likely to be something that they already 'know-about' in the sense they are aware of the facts; but a thing that they do not know.
Much of old age is about sifting-through memories and past impressions, things we already know-about, to discern what is important: to discover what we have 'missed' first-time-around. Often our priorities have been wrong, through our adult lives; and old age can be about re-ordering these priorities.
But what is vital is context! What is vital is to know why we need to do this. And the reason is because in old age we are preparing for what comes after death.
So old age should be less about the present - present concern often leading to an active quest for pleasure, or at least distraction - and more about the past and the future.
It is failure to acknowledge the context of the life beyond biological death, that makes modern society utterly incapable of dealing with ageing... For modern Man there is Nothing Good about ageing - it is pure decline; just as death, for a materialist, is 100% loss of self, rather than a transition.
In old age, we may find that the inevitable negative development, the incapacities, may (properly understood) serve to keep us focused upon our necessary task. For example, the problem of not being able to concentrate on reading in the same old way, a reduced ability to 'fill' our minds with new information, may encourage us to spend more time on thinking about the information we have already accumulated.
If we follow-up the negative constraints of our own particular, personal experience of ageing, understand and go with them rather than fighting them; the ratio of thinking/inputting may thereby increase in a valuable fashion... which is probably something that we should have done much earlier.