Web server and web domain



I am not sure where to put this question.

A web server usually hosts many domains, ie "abcd.com", "123456.com"
etc.

When I ping "abcd.com" or "123456.com", it returns a single IP
address.

How does a web server indentifies which domain to server ?

Thanks.
.