# Trigonometric term in digamma function $\psi_{0}(-n)$

Solutions to expressions s.a.

$$S(n)=\sum_{k=1}^{n}\frac{1}{k-r} = \psi_{0}(n-r+1)- \psi_{0}(1-r),$$

involves digamma function. For positive values it has the largest term $O(\log(n))$, but for negative it is dominated by a trigonometric term, $\pi \cot(\pi n)$, which is close or equal to $0$ for certain values.

My question is, where this trigonometric term comes from? There is nothing like this in Harmonic series.

$$\pi \cot(\pi z) = \frac{1}{z} + \sum_{k=1}^\infty \frac{2z}{z^2-k^2} = \frac{1}{z} + \sum_{k=1}^\infty \left( \frac{1}{k+z} - \frac{1}{k-z}\right)$$