He has a sickness that makes him unable to remember the number of rak‘ahs and prostrations; should he do the prostration of forgetfulness?
Question

                I have a sickness that makes me unable to remember whether I bowed or not, or whether I did one prostration or two, or whether I said takbeer or not. Please note that this sickness eases off on some days, and gets worse on other days. The problem is that even if I repeat the prayer more than once, it is the same. I feel that every time I bow or prostrate, I lose my memory. What I usually do is continue on the basis of having done more, and I do not do the prostration of forgetfulness, because Allah says (interpretation of the meaning): “Allah does not burden any soul with more than it can bear” [al-Baqarah 2:286].
Is my prayer valid?
Praise be to Allah.If there is a lot of uncertainty because of sickness or waswaas (intrusive thoughts; whispers from the Shaytaan), then no attention should be paid to them, and it is not prescribed to do the prostration of forgetfulness.
So do your prayer, and continue on the basis of having done more, as you said. In other words, do not pay any attention to the uncertainty.
This is the view of the majority of fuqaha’.
Al-Kaasaani al-Hanafi (may Allah have mercy on him) said, quoting from Muhammad ibn al-Hasan (may Allah have mercy on him): If a person is uncertain about some of his wudoo’, and it is the first time he is uncertain, then he should wash the part that he is uncertain about, because he is certain that there is an impurity in that spot, and is not sure whether he washed it.
What is meant by the phrase “it is the first time he is uncertain” is that uncertainty about such matters does not usually persist in his case, not that he never had this problem before. But if that happens to him a great deal, he should not pay any attention to it, because that is waswasah (intrusive thoughts), and the way to deal with waswasah is to ignore it, because if he focuses on it, that will lead to him being distracted in the prayer and unable to focus his mind whilst praying, and that is not permissible.
End quote from Badaa’i‘ as-Sanaa’i‘ (1/33).
As-Saawi al-Maaliki said:
If one who does not usually have a problem with waswasah is uncertain about some part of his body and whether the water reached it, then he must wash it by pouring water on it and rubbing it.
As for the one who does have a problem with waswasah, who is the one who encounters uncertainty often, what he must do is ignore it, because paying attention to waswaas will severely undermine his religious commitment; we seek refuge with Allah from that.
End quote from Haashiyat as-Saawi ‘ala ash-Sharh as-Sagheer (1/170).
Shaykh Mustafa ar-Ruhaybaani al-Hanbali said in Mataalib Ooli an-Nuha (1/507):
It is not prescribed to do the prostration of forgetfulness if there is a great deal of uncertainty (about one’s prayer) to the point that it becomes like waswaas (intrusive thoughts), in which case he should pay no attention to it. If he repeatedly becomes uncertain about wudoo’, ghusl or the removal of impurity, and tayammum, then he should ignore that uncertainty and waswaas, because that could lead to a kind of stubbornness, which could lead to adding to the prayer even though he is certain that he has done it properly. So he should ignore that waswaas and distract himself from it.
Conclusion: your prayer is valid, and we ask Allah to heal you and grant you well-being.
And Allah knows best.