I'm trying to understand the mathematical derivation given in the book "A Quantum Approach to Condensed Matter Physics" on page 215 (see 1), for explaining how the phonon-energy perturbed by phonon-electron interaction, namely

Let us suppose $q$ to be in the $x$-direction and of magnitude $2k_F$, and evaluate $\partial \hbar\omega_q^{(p)} / \partial q_x$.
If we neglect the variation of $M_{kk'}$ with $q$ the electron-phonon interaction contributes an amount
$$ 2 \sum\limits_k | M_{kk'}|^2 \langle n_k \rangle (\varepsilon_{k'} - \varepsilon_{k})^{-2} {\partial \varepsilon_{k-q} \over \partial q_x} .$$
On substituting for $\varepsilon_{k-q}$ one finds the summation to contain the factors $\langle n_k \rangle (k_x - k_F)^{-2}$. These cause a logarithmic divergence when the summation is performed [...]

What I don't grasp yet is the step of substituting for $\varepsilon_{k-q}$ (what exactly does one substitute with? $\varepsilon_k = \hbar^2 k^2 / 2m$?) and what the summation then looks like concretely to cause a logarithmic divergence.