It knows exactly how much of a site it has downloaded - the http protocol gives the exact size of each element it is downloading - the only exception is streamed elements or downloads that are generated on the fly; although the developer can either calculate the size or put a guestimate on the files header.
What it can't do, is tell you exactly how long it will take to load - it can make a guess by taking the average transfer speed for the page so far, but can't include fluctuations in bandwidth and server load.