Novice question:
Is the "www-" just part of the given subdomain or is there something else that occurs using that syntax?
"http://nlp.stanford.edu/IR-book/" resolves to the same resource.
"http://nlp.stanford.edu/IR-book/" resolves to the same resource.
Then (in the simplest case) the responding webserver is configured to treat the two hostnames (and possibly others) as identical and serve the same files.
So I guess there is magic. CNAMEs and virtual hosts and HTTP1.1.