Tim:
It doesn't. The web browser waits for something to answer it. Go on, try to get your web browser to connect to a non-existent server, it doesn't immediately stop looking. If you load up a page that might try waiting for a dozen different things before it will proceed and let you read something, it's a pain.
Samuel Sieb:
That's why you don't use a non-existent server. localhost exists, so you get an immediate rejection.
You can only get an immediate *rejection* if there's something there to reject it. If you don't have a webserver listening on the HTTP and HTTPS ports, and don't have a firewall rejecting connections, then the browser is going to wait for a connection, that's how it works. A rejection is very different from a no response (yet).
Surely all of you have sat there looking at the page loading spinner at some stage, wondering if a page is ever going to show up?
If you try browsing to a non-existent site, you're going to get a quickish failure. That's down to a quick domain doesn't exist DNS server response. If you try to connect to a domain that exists, but no server is responding (e.g. site failure) then you're going to get a delay while the browser waits.
If you're browsing an existing site, and that page pulls in things from a plethora of different services, which is what most ad-laden sites do, every one of those is a connection that will try to connect and wait for a timeout. If you're browsing a site that tries to stop you looking at the pages until the extra content has loaded, or is simply not authored well enough to load progressively, you'll get those delays compounding together.