First create a series representing the chance of getting a mini-figure, assuming there are 4:
$$(4/4) + (3/4) + (2/4) + (1/4)$$
The first one has a 100% of not being already taken. After that there are 3 remaining. Now 2, before finally trying to get that last Lego. The average amount of figures bought before getting the correct figure is the series' reciprocal, aka. 1/4 says I average 4 attempts before getting the figure. 3/4 says I average 4/3 attempts. The true series is for total attempts is:
$$(4/4) + (4/3) + (4/2) + (4/1)$$
In series notation I get:
$$\sum_{n=1}^4 \frac 4n$$
or, more generally, for $x$ number of figures:
$$\sum_{n=1}^x \frac xn = x\sum_{n=1}^x \frac 1n$$
Which equals $xH_x$, $H_n$ being the $n$th harmonic number (Harmonic numbers defined as $\sum_{n=1}^x \frac 1n$). The harmonic numbers approach $ln(x)$, proofs found elsewhere, so the total estimated numbers of attempts is $xln(x)$, substituting $H_x$ with $ln(x)$.
Note: Using the $ln(x)$ is semi-accurate, using the harmonic series is purely accurate. Even as $n$ approaches infinity, the $ln(x)$ is $0.5772156649...$ away from the harmonic series (That number is the Euler–Mascheroni constant).