The identity
$$\pi \cot(\pi z) = \frac{1}{z}+\lim_{N\to \infty}\sum_{|n| \le N}\frac{1}{z+n}=\frac{1}{z}+\sum_{n =1}^{\infty}\frac{2z}{z^2-n^2},$$
a version of which you state for real $t$, is old, and in some sense was known to Euler. It holds for all complex numbers $z$ which are not integers.

A full proof is given in in pages 142-144 of Stein and Shakarchi's "Complex analysis" (Princeton Lectures in Analysis, 2003), with references to 4 other proofs. The proof follows from establishing 3 properties for both sides of the identity: each side is a meromorphic function with simple poles at the integers, and no other singularities. Moreover, each side is periodic with period $1$. Finally, the residue of each side at $z=0$ is $1$.

They use this identity to give a rigorous proof for Euler's product formula for $\sin(\pi z)$, namely $\sin(\pi z)= \pi z\prod_{n \ge 1}(1-z^2/n^2)$.

I am not completely sure about the appearance of the factor $(-1)^k\cos(k\theta)$ instead of $0$ in your formula, though.