Peace be upon you. If you forget the Tashahhud and stand up for the third Rak'ah, and remember before bowing, you should sit down, recite the Tashahhud, then stand up and perform the Tasbih of the third Rak'ah again, and complete your prayer. It is recommended to perform two prostrations of forgetfulness after the prayer for the extra standing. If you remember the Tashahhud during the bowing of the third Rak'ah or afterwards, you should complete your prayer and then perform the two prostrations of forgetfulness. It is obligatory to make up for the forgotten Tashahhud before these prostrations. Source: Ayatollah Khamenei's rulings on prayer. Additionally, Ayatollah Sistani states that if you remember before bowing, you must sit and recite the Tashahhud and repeat the Tasbih if you had recited it. If you remember after bowing, you complete the prayer and then perform the two prostrations of forgetfulness. It is preferable to make up for the Tashahhud. Source: Official website of Ayatollah Sistani.