Most important is to remember with feeling the guru’s kindness and to follow their advice. Then remember our own mistakes and confess.
Long life pujas purify negative karma and accumulate merit—generally speaking life can be lengthened by accumulating merit. The best kind of long life puja is not just the ritual, but cherishing the advice, with the thought correctly devoting to the virtuous friend, looking at the guru from our own side as the Buddha and remembering their kindness; feeling regret for not practicing properly in the past and making a decision to practice better in the future; generally speaking in the ordinary sense, to be a better person.
The heaviest effect on the guru’s life is degenerating or breaking the first root tantric vow of belittling the guru—this means giving up the guru as an object of respect. Also having anger or heresy arise in the mind toward the guru, particularly heresy. When there is heresy, the mind is barren like a desert, having no faith and where nothing can grow. This can cause the holy mind to be disturbed, like a sadness.
Sometimes there can be students who request secret tantric teachings and not having devotion can cause the guru (in the context of very secret teachings) to break samaya because the teacher has difficulty saying no. If the student has the sincere thought to try to develop and keep the vows and so forth, then it’s good, although of course it may be difficult to keep all the vows because the student’s mind does not even have the realization of impermanence and death!
Harmonious sincerity in obtaining advice can inspire the guru. This can give the guru the interest to have the intention to pray in an attempt to have a long life, even if from the guru’s side there is not the complete capability to control the elements.
It is important to be aware that when students break root tantric vows, samaya and so on, this is also a danger for themselves, resulting in sickness and even in their own life being shortened, not to mention suffering in future lives. Of course, as explained in the teachings, any degeneration or breaking of the three levels of vows can be purified through confession, etc.
So these things can cause the guru to take disease and pass away early; this is a dependent arising. This can happen because of the karma of the group, for example, with my gurus, they don’t have karma, but they can show the appearance.
In conclusion, a lot depends on how well the student practices Dharma and how much self-cherishing thought there is, which causes harm to ourselves and others.
I don’t think the problem has so much to do with the fact that students don't know the cause of the guru taking disease and passing away early. For some students the cause is not being thoughtful and not taking the opportunity to change their life for the better, for example, not putting the teachings into practice.