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.