It is sunna for one who, intentionally or absentmindedly, leaves out a main sunna to prostrate for forgetfulness at the end of one's prayer.
One who intentionally leaves out a main sunna has even greater reason of prostrating because he is neglectful.
It is permissible to return to the missed main sunna only as explained below:
-a- If one absentmindedly misses a main sunna, then:
1- If one has begun the obligatory act that follows the missed main sunna then he is forbidden to return to that main sunna.
One must finish the prayer and then is recommended to prostrate for forgetfulness.
If one returns deliberately while aware that it is forbidden to do so, then one's prayer is invalid.
An example of being in the act of an obligatory rukn is when one misses the first testification of faith and does not recall it till he stands upright, or misses the supplication of qunut and does not recall it till he prostrates.
The criterion of being in the act of standing upright (in the case of missing the testification of faith) is reaching a position at which Quran recital counts, that is when one straightens one's posture beyond the least bowing limit.
The criterion of being in the act of prostration (in the case of missing
the supplication of qunut) is to bear the weight of all the body parts of prostration on the ground even if one does not repose therein.
2- If one has not initiated an obligatory act, one is permitted to return to the forgotten sunna.
If one performs the missed sunna, one need not prostrate for forgetfulness, unless, when missing the first testification of faith, he
reaches a point at which he is closer to standing than to prostration, or, when missing the supplication of qunut, he reaches while moving
downwards the minimal form of bowing.
In these two cases, one is still permitted to return to the missed sunna and is recommended to prostrate for forgetfulness at the end of one's prayer.
-b- If one intentionally leaves out a main sunna:
It is not permissible to return to the intentionally left out sunna unless one (in the case of leaving out the first testification of faith) is closer to prostration than to standing, or (in the case of missing the supplication of qunut) has not reached the least bowing limit while moving down.
In both cases, if one returns to the missed main sunna he need not prostrate for forgetfulness, otherwise (if one does not return) he is recommended to.