If you change from the speakers to the headphones in Windows, you have to set the whole thing again in TeamSpeak. TeamSpeak does not automatically adjust to the Windows settings. There is no direct solution to this, but with a hotkey for a second playback profile the device can be switched much faster.
Under Tools > Options > Playback you can find the playback profiles with their respective settings. With the small "plus" you can add a profile.
Under Tools > Options > Hotkeys you can now set a hotkey to switch between the playback profiles. Next:
+ Add > Show Advanced Actions > Playback Profile > Toggle Playback Profile
Now we see the two playback profiles we just created: Headphones and Speakers. Click one of them, which does not matter. Click No Hotkey Assigned and select the desired hotkey to toggle. Confirm with OK.
This way, the TS3 sound can be switched from speakers to headphones and vice versa with one touch of a button.
Important for Bluetooth Headphones
If you use bluetooth headphones instead of wired headphones, it is important to set the headphones for the second playback profile. TS3 always uses the top profile as the default profile and will also try to select this when launching. If that does not work because the headphones are still switched off, an error message will occur.
It is therefore generally advisable to always set the speakers for the upper playback profile and the headphones for the lower playback profile.