Let's say I have a grand partition function with two states $\epsilon_1$ and $\epsilon_2$:
\begin{equation} Z = \sum\limits_i \exp\left[-\beta\left(\epsilon_1 n_1+\epsilon_2 n_2 - \mu n_i\right)\right], \end{equation} where $n_1+n_2 = n_i$. Better formulation is in the comment of @By Symmetry.
I am interested in obtaining the average $n_1$.
WRONG APPROACH:
I can rewrite my partition function as: \begin{equation} Z = \sum\limits_i \exp\left[-\beta\left(\epsilon_1 n_{1i}+\epsilon_2 \delta^{-1} n_{1i} - \mu (1+\delta^{-1}) n_{1i}\right)\right], \end{equation} where I used $\delta = n_1/n_2$.
If I take partial derivative over $\mu(1+\delta^{-1})$ this does NOT give me the average number of particles in the state $\epsilon_1$, because there is $\delta^{-1}$ in front of the $\epsilon_2$ term. Is there a way around it?
EDIT: $\delta$ is a bad variable as @Roger Vadim mentioned