I'm looking over the solution of an exercise in a course I'm taking and there's something I simply don't understand. Let $f(z)=\pi\cot(\pi z)$ and $\varphi(z) = \frac{1}{z^2}$. $f$ has poles of order $1$ in the points $k\in\mathbb{Z}$ and $\varphi$ has a pole of order $2$ at $0$. Now in the solution of the exercise it is written that from the residue theorem the following holds:
$$\frac{1}{2\pi i} \int_\gamma f\cdot\varphi \, dz=\operatorname{Res} (f\varphi,0) + \sum\varphi(k)\operatorname{Res}(f,k)$$
where $\gamma$ is a simple positively oriented close curve and the sum extends over the values of $k\in\mathbb{Z}$ contained in the interior of $\gamma$. Now the standard form of the theorem would be:
$$\frac{1}{2\pi i} \int_\gamma f\cdot\varphi \, dz = \sum \operatorname{Res} (f\cdot\varphi,k)$$
So for some reason for $k\neq0$ it holds that $\operatorname{Res}(\varphi f,k) = \varphi(k) \operatorname{Res} (f,k)$, why is that?
Is it more generally true that if $f,g$ are functions such that $z_0$ is a singularity of $f$ but not of $g$ then $\operatorname{Res}(f\cdot g,z_0) = g (z_0) \cdot \operatorname{Res} (f,z_0)$. Is it maybe necessary to assume that $z_0$ is not a zero of $g$ for this to be true?
Help would be appreciated.