The first and second Taslim (i.e – saying Assalamu Alaikum Wa Rahmatullah) are both pillars of the Salah that must be performed according to the Mu’tamad (relied-upon position of Madhhab), because it is not authentically reported that the Messenger (peace be upon him) ever left them. They are a part of the Salah, so, the one who comes late to the Salah must not stand up until the Imam has completed both*.
The second Taslim is not compulsory in:
a) the funeral prayer,
b) the prostration of recitation,
c) and the prostration of thankfulness.
As for Nafl prayers, then the difference of opinion in this issue within the Madhhab is strong:
Qadi Abu Ya’la (r), Ibn Qudamah (r), and Al-Majd (r) considered the second Taslim recommended, as per the position of the vast majority of scholars. This was chosen in Al-Iqna’ and Ghayatu-l Muntaha. The apparent position of Muntaha-l Iradat is that they are both compulsory in the Nafl prayer too, and this was explicitly stated by al-Buhuti (r) and al-Khalwati (r) in the Hashiyah.
And Allah knows best.
*Note: The second Taslim ends when the Imam has completed saying Assalamu ‘Alaykum Wa Rahmatullah and not when he has completed turning his head, as he may well have turned his head completely to the left but is still half way in saying the Taslim.