They don't actually change teams. You can't make a T switch to CT or a CT switch to T.
What really happens is the teams change spawns. It is really really complicated and involves trigger_teleports with trigger_changetargets.
You can download the .MAP of l337sk337 if you want to see how I did it I don't really remember exactly how it works...
http://www.superjer.com/files/awp_lsb_source.zip