How do I average frequency spectra?

How did letter d.) become letter e.)? How do we perform this averaging process? Its clear the averaging the signal causes some noise to be reduced.

If you are in a position to acquire $N$ snapshots of data, $s_n(t)$, for $n=0\ldots N-1$ then you can just do:
$$S_n(k) = |\mathrm{fft}(s_n(t))|^2\\ \hat{S}(k) = \frac{1}{N} \sum_{n=0}^{N-1} S_n(k)$$