With web browsers that support HTTP/1.1 (as most do), upon connecting to a webserver, they send the address that the user typed into their browser's address bar (the URL). The server can use this information to determine which webpage to show the user.
For instance, a server could be receiving requests for two domains, www.site1.com and www.site2.com, both of which resolve to the same IP address. For www.site1.com, the server would send the HTML file file from the directory /www/JoeUser/site1/, while requests for www.site2.com would make the server serve pages from /www/FrankUser/site2/.