1. If the Imam gives Salaam before the follower has finished Tashahhud, the follower completes the Tashahhud, because it is Wajib, then gives Salaam. If only Salawat or dua remains, the follower leaves that Sunnah material and follows the Imam's conclusion.
2. If the Imam rises from Ruku or Sujud before the follower has completed three Tasbihs, the follower follows the Imam rather than remaining behind merely to complete the Sunnah count.
The practical principle is: do not abandon a Wajib already being completed for a Sunnah, but do not delay following the Imam merely to finish a Sunnah.