I am stuck in the way this textbook shows how Planck arrived in the conclusion that the energy of a particle must be discrete. I have done the following, assuming that the energy $\Delta E$ is discrete, we cannot integrate it, thus we use the sum as it follows. $$ \langle E \rangle = \frac{\sum^{\infty}_{n =0}n\cdot \Delta E \cdot f(n\Delta E) }{f(n\Delta E)} $$ where f is still the Boltzmann distribution, $$ f(n\Delta E) = \frac{e^{\frac{-n\Delta E}{KT}}}{KT} $$ so, $$ \langle E \rangle = \frac{\Delta E(0e^{\frac{-0\Delta E}{KT}}+1e^{\frac{-1\Delta E}{KT}}+2e^{\frac{-2\Delta E}{KT}}+\dots)}{e^{\frac{-0\Delta E}{KT}}+e^{\frac{-1\Delta E}{KT}}+e^{\frac{-2\Delta E}{KT}}\dots}= \frac{\Delta E e^{\frac{-\Delta E}{KT}}(0 + 1 + 2e^{\frac{-\Delta E}{KT}}+3e^{\frac{-2\Delta E}{KT}}+\dots)}{(1 + e^{\frac{-1\Delta E}{KT}}+e^{\frac{-2\Delta E}{KT}}+ \cdots)} $$ where, $$ (0 + 1 + 2e^{\frac{-\Delta E}{KT}}+3e^{\frac{-2\Delta E}{KT}}+\dots) = \frac{1}{(1-e^{\frac{-\Delta E}{KT}})^2} $$ and, $$ (1 + e^{\frac{-1\Delta E}{KT}}+e^{\frac{-2\Delta E}{KT}}+ \cdots) = \frac{1}{1-e^{\frac{-\Delta E}{KT}}} $$ and then, $$ \langle E \rangle = \frac{\Delta E(1 - e^{\frac{-\Delta E}{KT}})}{(1 - e^{\frac{-\Delta E}{KT}})^2} = \frac{\Delta E}{(e^{\frac{\Delta E}{KT}} - 1)} $$
but in the textbook I am using, there is a derivative out of nowhere, can anyone explain me where it comes from?