Partial proof, not entirely self-contained.
Both sides depend linearly of $f$, because $\mathrm{Res}(\lambda g+h,a) = \lambda \mathrm{Res}(g,a) + \mathrm{Res}(h,a)$ for all meromorphic functions $g,h$ on $\mathbb{C}$ and all $\lambda \in \mathbb{R}$ (by convention, the residue is $0$ if $a$ is not a pole). Note the condition $\mathrm{deg}(p) \le \mathrm{deg}(q)-2$ forces the sum of all residues of $p/q$ to be $0$.
The equality to be proved is already known when $q(0) \ne 0$. Using decomposition into simple elements and linearity, it suffices to check it
for fractions $1/z^k$ with $k \ge 2$, and for fractions of the form
$$\frac{1}{z-a} -\frac{1}{z} = \frac{a}{z(z-a)}, \text{ where } a \in \mathbb{C} \setminus \mathbb{Z}.$$
For fractions $1/z^k$ with $k \ge 2$, the equality is true (both sides are null if $k$ is odd, and for $k$ even, this is the classical relation between $\zeta(k)$ and the Bernoulli number $B_k$).
For fractions $\frac{a}{z(z-a)}$ \where $a \in \mathbb{C} \setminus \mathbb{Z}$, one may observe that
\begin{eqnarray*}
\sum_{k \in \mathbb{Z} \setminus\{0\}} \Big(\frac{1}{k-a} - \frac{1}{k}\Big)
&=& \sum_{k=1}^{+\infty} \Big(\frac{1}{k-a} - \frac{1}{k} + \frac{1}{-k-a} - \frac{1}{-k}\Big) \\
&=& -\sum_{k=1}^{+\infty} \Big(\frac{1}{a-k} + \frac{1}{a+k}\big) \\
&=& \frac{1}{a} - \pi\cot(\pi a).
\end{eqnarray*}
The residue of $z \mapsto \frac{a\cot(\pi z)}{z(z-a)}$ at $a$ is $\cot(\pi a)$.
The residue of $z \mapsto \frac{a\cot(\pi z)}{z(z-a)}$ at $0$ is $-1/(\pi a)$ since, as $z \to 0$,
\begin{eqnarray*}
\frac{a\cot(z)}{z(z-a)}
&=& -z^{-1}\cot(\pi z)\frac{a}{a-z} \\
&=& -\big(\pi^{-1}z^{-2} + O(1)\big) \sum_{n=0}^{+\infty}\frac{z^n}{a^n} \\
&=& -\pi^{-1}z^{-2} -\pi^{-1}a^{-1}z^{-1}+O(1).
\end{eqnarray*}
[1]: About the proof of $\sum\limits_{n=-\infty}^\infty f(n)=-\pi\sum\limits_{k=1}^m\text{res} [f(z)\cot(\pi z)]_{z=a_k}$?