Let $f$ be the Fermi function and $H$ be a function which which vanishes as $\epsilon \to -\infty$ and which diverges at $\infty$ no worse than some power of $\epsilon$. In the Sommerfeld expansion of solid state physics (see e.g. Ashcroft and Mermin Appendix C), one writes an integral of the form $$\int_{-\infty}^\infty H(\epsilon)f(\epsilon)\, d\epsilon$$ instead as, for some $\mu \in \mathbb{R}$, $$\int_{-\infty}^\infty H(\epsilon)f(\epsilon)\, d\epsilon = \int_{-\infty}^\mu H(\epsilon)f(\epsilon)\, d\epsilon + \sum_{n=1}^{\infty}\int_{-\infty}^\infty \frac{(\epsilon - \mu)^{2n}}{2n!}(-\partial f/\partial \epsilon)\, d\epsilon \left(\frac{d^{2n-1}H}{d\epsilon^{2n-1}}\right)(\mu).$$ The key step is doing a Taylor expansion of $K(\epsilon) := \int_{-\infty}^\epsilon H({\epsilon'})\,d\epsilon'$ about $\epsilon = \mu$ and then exchanging the infinite sum and integral.
My question is, when is this exchange justified? In particular, $H$ usually has some sort of lack of smoothness at $\epsilon = 0$ (e.g. in 2D, $H$ can be a positive constant for $\epsilon>0$ and $0$ for negative numbers). I would have thought that the expansion would be rigorously valid as long as we restrict ourselves to $\mu >0$ (since usually $H = 0$ for $\epsilon<0$ so that $\int_{-\infty}^\infty H(\epsilon)f(\epsilon)\, d\epsilon = \int_{0}^\infty H(\epsilon)f(\epsilon)\, d\epsilon$ anyway), and yet I have just worked a problem which shows that this is not so; that somehow the exchange "knows about" the singularity at $0$ in spite of the fact that $\epsilon < 0$ "doesn't matter". I'm hoping someone can help me understand what's going on.
Further, some of my confusion lies in that, in 3D (where $H$ is not differentiable) the expansion works whereas in 2D (where $H$ is not continuous) it does not work. Does the fact that the expansion is valid to one extra term in the 3D case really change things that materially?