Infinite sum of 1/sin^2 and theta function In studying some physical propagator, I came across the following sum
$$
\sum_{n = -\infty}^{+\infty} \frac{ a^n }{ \sin^2(z + n \pi \tau) }\ . 
$$
Obviously, my question is how to evaluate this sum.
To some extent, I understand the result when $a = 1$. Loosely speaking, without properly regularizing, we have
$$
\sum_{n \in \mathbb{Z}} \frac{ 1 }{ \sin^2(z + n \pi \tau) } = - \sum_{n \in \mathbb{Z}} \partial_z \partial_z \ln \sin(z + n\pi\tau) = - \partial_z^2 \ln \prod_{n \in \mathbb{Z}} \sin(z+n\pi\tau) \ .
$$
The final infinite product can be identified with $\theta_1(z/\pi|\tau)$, where $q = e^{2\pi i \tau}$, so up to regularization issue, we have
$$
\sum_{n\in \mathbb{Z}} \frac{ 1 }{ sin^2(z + n\pi \tau) } = - \partial_z \partial_z \ln \theta_1(z/\pi|\tau)
$$
However in the presence of $a^n$, I can't pull off this trick again (as far as I can see). 
Suggestions on literature/references and more tricks are welcome!
 A: The following is probably not mathematically rigorous, and is loosely based on the Ramanujan's identity
\begin{align}
  \sum_{n = -\infty}^\infty \frac{ (A;q)_n }{ (B;q)_n }X^n
  = \frac{(q;q) (B/A;q) (AX;q) (q/(AX))}{(B;q)(q/A;q)(X;q)(B/(AX);q)} \ .
\end{align}


*

*The original problem can be rephrased (assuming $\partial_z$ can be moved into the sum),
\begin{align}
  F(z) \equiv & \ \sum_{n \in \mathbb{Z}} \frac{1}{\sin^2(\frac{z}{2} + n \pi \tau)} a^n = -2 \partial_z \sum_{n \in \mathbb{Z}}\frac{\cos(\frac{z}{2} + n\pi \tau)}{\sin(\frac{z}{2} + n\pi \tau)} a^n \equiv -2 \partial_z G(z).
\end{align}

*To compute $G(z)$, we reorganize it
\begin{align}
  G(z) = - i \sum_{n \in \mathbb{Z}}
      \frac{e^{i(z + 2 n\pi \tau)}}{1-e^{i(z + n2\pi \tau)}} a^n
      - i \sum_{n \in \mathbb{Z}}
      \frac{1}{1 - e^{i(z + 2 n\pi \tau)}} a^n \ .
\end{align}
Defining $x \equiv e^{iz}$, $q = e^{2 \pi i \tau}$, we have
\begin{align}
  G(z) = -i \frac{x}{1-x} \sum_n \frac{(x;q)_n}{(qx;q)_n} (aq)^n - i \frac{1}{1-x} \sum_n \frac{(x;q)_n}{(qx;q)_n} a^n \ ,
\end{align}
where we used
\begin{align}
  \frac{1}{1-xq^n} = \frac{1}{1-x} \frac{(x;q)_n}{(qx;q)_n} \ .
\end{align}

*Now Ramanujan's identity comes in, and using shift properties of the $q$-Pochhammer symbols, the two sums actually are equal and they add. The final result is
\begin{align}
  G(z) = 2 \eta(\tau)^3 \frac{ \vartheta_1(\mathfrak{a} + \frac{ z}{ 2\pi }|\tau) }{ \vartheta_1(\frac{ z}{ 2\pi }|\tau)\vartheta_1(\mathfrak{a}|\tau )}\ .
\end{align}

*The above computation is not rigorous because the Ramanujan's identities requires $|q| < 1$ ,$|B/A| < |X| < 1$ for convergence. However, these requirements applied to the two sums at the end of step 2 are not compatible: one sum requires $|a| < 1$, the other $|a| > 1$. Besides, we need to move the $\partial_z$ into a sum.

*However the final answer seems physically reasonable, since it does produce physical results that we expect, despite the above issue.
