I'm looking at a specific derivation on wikipedia relevant to statistical mechanics and I don't understand a step.
$$ Z = \sum_s{e^{-\beta E_s}} $$
$Z$ (the partition function) encodes information about a physical system. $E_s$ is the energy of a particular system state. $Z$ is found by summing over all possible system states.
The expected value of $E$ is found to be:
$$ \langle E \rangle = -\frac{\partial \ln Z}{\partial \beta} $$
Why is the variance of $E$ simply defined as:
$$ \langle(E - \langle E\rangle)^2\rangle = \frac{\partial^2 \ln Z}{\partial \beta^2} $$
just a partial derivative of the mean.
What about this problem links the variance and mean in this way?
The answer is valid for the partition sum $Z$ (which is closely related to the moment generating function). The reason is the special structure of the partition sum $$Z = \sum_s e^{-\beta E_s}.$$ The system is characterized with probability $$P_s=\frac{e^{-\beta E_s}}{Z}$$ that a state $s$ with energy $E_s$ is attained.
Given this definition it is easy to see that $$-\partial_\beta \ln Z = -\frac{\partial_\beta Z}{Z} = \sum_s E_s \frac{e^{-\beta E_s}}{Z}= \sum_s P_s E_s =\langle E \rangle .$$
Similarly, one can easily convince oneself that $$ \begin{align*} \partial_\beta^2 \ln Z &= -\partial_\beta \left[ \sum_s E_s \frac{e^{-\beta E_s}}{Z} \right] =\sum_s E_s^2 \frac{e^{-\beta E_s}}{Z} - \left[ \sum_s E_s \frac{e^{-\beta E_s}}{Z}\right] \left[\sum_{s'} E_{s'} \frac{e^{-\beta E_{s'}}}{Z}\right]\\ &= \langle E^2\rangle -\langle E\rangle^2 = \langle (E- \langle E\rangle)^2\rangle, \end{align*}$$ i.e., the variance is given by the second derivative of $\ln Z$.