The answer is very simple, although most physics texts don't take the time to explain it. The partial derivative with respect to a complex variable $z = x + i y$ or it s complex conjugate $\bar{z} = x - i y$ is defined by the so-called Wirtinger derivative
$$
\frac{\partial}{\partial z} = \frac{1}{2} \left( \frac{\partial}{\partial x} - i \frac{\partial}{\partial y} \right), \quad \frac{\partial}{\partial \bar{z}} = \frac{1}{2} \left( \frac{\partial}{\partial x} + i \frac{\partial}{\partial y} \right)
$$
If you'd like, you can just treat the derivative symbols on the left as notation, defined by the expressions on the right. But they have the very nice properties (which you should check by hand)
$$
\frac{\partial}{\partial z} z = 1, \quad \frac{\partial}{\partial z} \bar{z} = 0, \quad \frac{\partial}{\partial \bar{z}} \bar{z} = 1, \quad \frac{\partial}{\partial \bar{z}} z = 0
$$
and so on. In other words, the Wirtinger derivatives work exactly as if you were differentiating $z$ and $\bar{z}$ as independent variables.
This is especially useful in extremization problems, as in your post. To extremize $E$, you are always welcome to break $\phi_n$ into a real part $x_n$ and an imaginary part $y_n$, and differentiate those. But if $\partial_{x_n} E = 0$, and $\partial_{y_n} E = 0$, then clearly $\partial_{\phi_n} E = 0$ and $\partial_{\bar{\phi}_n} E = 0$ from the definitions of the Wirtinger derivatives. So, you are always allowed to instead use the Wirtinger derivatives to differentiate with respect to $\phi_n$ and its complex conjugate, treating them as independent, and set those derivatives equal to zero.