Every hash attempt, regardless of who does it, or what difficulty it occurs at, is an independent evaluation of a hash function, resulting in a number uniformly distributed between 0 and 2256 - 1.
Now consider the distribution of the minimum of N independent samples. See this question for a derivation, but the result is that the average of that distribution is approximately 2256 / (N+1).
This gives an intuition about the relation between the smallest observed hash and the number of hashes performed: on average, the minimum will scale approximately proportional to 1 / (N+1) with N performed hashes.
The statistical tool for estimating N from the observation is called likelihood estimation: we have a probability distribution with unknown parameter N, and make one observation from that distribution. That distribution of the minimum of N hashes (if we simplify it a bit by turning the output of hashing into a continuous real function, uniformly distributed over [0, 2256]), has probability density function fN(x) = N(1-x/2256)N-1. Given an observation min_hash, the value for N that maximizes fN(min_hash) (the maximum likelihood estimator) is -1 / log(1 - min_hash/2256). For small values of min_hash, that expression is closely approximated by 2256/x - 1/2.