By using DNS. Your computer talks to a DNS server. The DNS server contains records (much like a database). In the case of a translating a
name to an IP address, you want the DNS server to give you a record known as an A-record. See
here for the complete list of records possible (not all will be used).
You can force your computer to do a DNS query by using the windows cmd prompt, and typing ipconfig /flushdns (to clear the local
cache) and then ping a site.
Or, just ping something you have not communicated with in the past - I did a website ping, and this was the result.
Notice the query website address, and the response, circled in red. The 82.150... address is the IP address.
Also notice that the PC also automatically did a DNS query for an 'AAAA-record' immediately afterwards. AAAA is for an IPv6 address
request. Notice from the response that the website company doesn't yet have a public IPv6 address (bad practice on their behalf in my opinion - large
organizations should be implementing IPv6).
(That software in the screenshot is called wireshark by the way).