If I flip a fair coin repeatedly, and tell you that I found 1 billion heads, it's (practically) statistically certain that I flipped the coin very nearly 2 billion times. The same sort of extrapolation can determine the total network power based on the success rate.
– Tim S.Jan 30 '14 at 21:53

The reason we use a day to average out the hash_rate is that taken block by block the variance would be really high and we would not get anything meaningful.

According to WolframAlpha this gives us an averagge hash_rate for the 22nd May 2013 of 86.19 THashes/s. Numbers of course may vary depending on how you chose your interval, which appears to be the reason numbers don't match with the ones on Blockchain.info

I know this answer was given 5 years ago, but why 2**32? I'm presuming it has something to do with the 256-bit hashing function used, but some clarification would be awesome :)
– glowkeeperOct 4 '18 at 13:34

Thanks, @JBaczuk! Looks good! I should probably check that answer against mine (bitcoin.stackexchange.com/questions/79774/…), but I'm currently knee-deep in code, so I'll report back later, once I've done some back-of-the-envelope-calc's :)
– glowkeeperNov 16 '18 at 9:53

The network hash rate can be statistically inferred from the difficulty and the rate at which blocks are found. It's just a more complex version of the fact that if you know that someone is flipping coins and heads comes up 800 times an hour, they're flipping about 1,600 coins an hour.