They may use wildcard DNS, or update the DNS to add extra host names for those users.
Then they probably run a default virtual host which points all these host names to the same directory.
Inside this directory, a server-side (e.g. PHP) web application, reads the "Host:" header and then modifies its behaviour accordignly.
For example, in PHP you'd get this with $_SERVER['HTTP_HOST']
Mark