There are several ways to estimate the number of blocks left to download. The easiest is likely that the client takes a look around at what its peers are saying their longest chain currently looks like. So if you connect to 8 peers in the network it is very unlikely that all of them are still catching up with the rest of the network and therefore it will tell you what the current state, or something close to it is.
Another way of estimating the number of blocks is by looking at the timestamp included in the block that you just downloaded. In expectation a block should arrive every 10 minutes. The timestamp in the block is not allowed to deviate from the actual time it was mined by more than a fixed number of minutes (otherwise it would be rejected when it is first seen). So if you subtract the time of the last block you downloaded from the current time and then divide by 10 minute intervals you get an estimate of the total number of blocks in the network.
Notice that the second method may not be incredibly precise, especially in times the commputational power in the network grows quickly, like it is currently doing, or is reduced quickly.
As for you checking how many blocks are left, it's a simple matter of going to a trusted block explorer and comparing your blockchain height with the height they display.