The magic in hidden in a small file called "HOSTS" which resides in your Windows System folder (Some installations of Windows may use different names for the Windows folder. Substitute the name of your Windows folder for either Windows or Winnt.)
Windows XP = C:\WINDOWS\SYSTEM32\DRIVERS\ETC
Windows 2K = C:\WINNT\SYSTEM32\DRIVERS\ETC
Win 98\ME = C:\WINDOWS
The Hosts file is more like an phone book - it maps the IP addresses to host names. When Windows starts, this particular file is loaded in memory and any query to DNS server is first routed through the Hosts file. This provides you with the flexibility to override addresses in the DNS by redirecting any connection attempts back to the local machine, commonly referred as 127.0.0.1.
For instance, the host name for Yahoo! is www.yahoo.com, while its IP address is 22.214.171.124 Either address will take you to Yahoo!'s site, but the www address will first have to be translated into the IP address. If you type in the IP address directly, your computer will not have to look it up.
The entries above blocks all objects (like images, streaming audio, video, text content) from the xxx-pixx.com servers and these sites can't even track your movements.
It also enables quick loading of websites as you computer doesn't need to query external DNS servers for the address translation.
This mechanism also blocks the "phone home" feature. If you think that some bad software (adware or spyware) is trying to connect to the author's site in the background, just put an entry for that website in your HOSTS file and all access from your system to that website would be blocked.
If all this is sounding too complicated, just download a freeware HostsMan that lets you manage your Hosts file. The folks at http://www.mvps.org have provided a ready-to-use HOSTS file (202 kb) which blocks most of the bad sites. And they do update it regularly. The last update was just a week back.
Some hijackers may try to playaround with your hosts file by blocking access to all virus scanning / security related sites like mcafee, norton so don't forget to set your host file as read-only once you are done editing it.