وَإِنْ سَهَا عَنِ الْقَعْدَةِ الْأَخِيرَةِ، فَقَامَ إِلَى الْخَامِسَةِ: رَجَعَ إِلَى الْقَعْدَةِ مَا لَمْ يَسْجُدْ، وَأَلْغَى الْخَامِسَةَ، وَسَجَدَ لِلسَّهْوِ.
Translation: If one omits the final sitting and rises to a fifth rakah, one returns to the final sitting before performing a prostration of the fifth, disregards the extra rakah, and performs sujud al-sahw.
The final sitting is a pillar in a four-rakah fard prayer. Before prostrating in the unintended fifth rakah, the person can still recover that final sitting by returning.
This differs from the first sitting, which is wajib, not fard.