The website saves a list of steam ID's as well as what team they are assigned.
A plugin will take care of reading the list (usually, such things are well done via MySQL!), and assigns each player to the team they should be on once they join.
The plugin also listens and ensure that players cannot move them self into the incorrect team, with the normal team handling of the game.
__________________
Mostly known as "DarkDeviL".
Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].