A Muslim performs sujud as-sahw (prostration of forgetfulness) in case he forgets a non-obligatory part of the Prayer, whether this Prayer is obligatory, recommended (sunnah) or supererogatory (nafl). The prostration of forgetfulness does not apply if one forgets something of the Janazah (funeral) Prayer.
Focusing on the question in point, the prominent Muslim scholar Dr. `Abdur-Rahman Al-`Adawi, professor of Fiqh at Al-Azhar University, states:
Sujud as-sahw is required in case one forgets a non-obligatory act of any Prayer. There is no difference whether the Prayer is fard (obligatory) or nafl (supererogatory).
This includes all prayers except the funeral Prayer, the prostration of recitation (sujud at-tilawah), prostration of thankfulness (sujud ash-shukr). In these three, the prostration of forgetfulness is not needed.
As for the funeral Prayer, it is originally performed without prostration. Thus, there is no place for the prostration of forgetfulness in there.
Regarding the prostration of recitation and the prostration of thankfulness, if one performs the prostration of forgetfulness, it will be an addition to the original.
Here, it is to be noted also that if one forgets or got distracted while performing the prostration of forgetfulness, one is not required to perform another prostration of forgetfulness.
The prostration of forgetfulness is thus required in case one adds something or loses something from Prayer, and in case of doubt regarding Prayer [i.e., one is uncertain how many rak`ahs one has performed]. This involves both obligatory and non-obligatory Prayer, except the above-mentioned three.
Needless to say that when a Muslim forgets an obligatory act, he has to make up for it (that part by performing it again) and to perform the prostration of forgetfulness also as a kind of compensation for forgetfulness.