When you visit a site like google.com it looks in your DNS settings to see which DNS server(s) [Often your ISP's] to query they then send back an IP address which your computer then uses to get the webpage.
When you get the IP sometimes it will store a copy in your DNS record, or that record can become corrupted (thats what happens when you get a browser hijacker - it adds an entry in your local DNS saying for google.com send to somebadsite.com)
As your local DNS takes priority over all other possible returns it will always look there until the record is removed. Usually this should happen after x amount of views, but sometimes for whatever reason it doesn't. This removes the records thus letting your computer query the DNS Servers to get the new IP address.
It's a bit more complicated than that, but that's the general gist of it.