Evaluation of $\sum_{m,n=-\infty}^{\infty} (m^2+Pn^2)^{-s}$ where $(m,n)\neq 0$ I was trying to learn about evaluating certain double sums and came across this formula:

$$\sum_{\begin{matrix}m,n=-\infty \\ (m,n)\neq (0,0)\end{matrix}}^{\infty} \frac{1}{\left( m^2+Pn^2\right)^{s}}=2^{1-t}\sum_{\mu|P}L_{\pm \mu}(s)L_{\mp 4P/\mu}(s)$$
  where $P\equiv 1 \ \ (\text{mod } 4)$ and $t$ is the number of distinct factors of $P$. Also
  $$L_{\pm d}(s)= \sum_{n=1}^\infty \left( \frac{\pm d}{n}\right)n^{-s}$$
  are the primitive $L$ series modulo $d$. $\left(\frac{k}{n}\right)$ is the Kronecker symbol.

I verified this formula numerically for $P=5,9$ and it gave correct results. Can you please help me prove this formula?
 A: I believe the claim is false in general. The residues at $s=1$ do not match. Indeed, let us consider the simplest case where $P=p$ is prime and $\equiv 1 \mod 4$. It is easy to see that $\mathcal O_K^\times=\{\pm 1\}$, where $K=\mathbb Q(\sqrt{-p})$. The claimed equality is then
$$\sum\frac{1}{m^2+pn^2} = L_1(s) L_{-4p}(s) + L_p(s)L_{-4}(s).$$
We have $L_1(s) L_{-4p}(s) = \zeta(s)L(\theta_K, s) = \zeta_K(s)$, where $\theta_K$ is the quadratic character of conductor $4p$ attached to $K$, and $\zeta_K$ is the Dedekind zeta function. The term $ L_p(s)L_{-4}(s)$ is holomorphic at $s=1$, so it contributes nothing to the residue. Moreover, the sum
$$\frac{1}{2}\sum\frac{1}{m^2+pn^2} := L(\mathfrak c_0, s)$$
can be identified with the sum of $\|I\|^{-s}$, for $I$ running over the principal ideals of $K$ (i.e. the elements of the trivial ideal class $\mathfrak c_0$). (I divided by two because $\mathcal O_K^\times=\{\pm 1\}$.) A classical result states that the ideals are uniformly distributed among the ideal classes, i.e. that $\text{res}_{s=1} L(\mathfrak c, s) = \kappa/h$, where $h = |\text{Cl}(\mathcal O_K)|$, $\kappa = \text{res}_{s=1} \zeta_K(s)$, and $\mathfrak c$ is any ideal class. Comparing the residues on both sides yields
$$2\kappa/h = \kappa \Rightarrow h=2$$
which implies that the residues coincide only if $h=2$. So the formula is false as soon as $\mathbb Q(\sqrt{-p})$ has class number $\neq 2$.
Remark: this doesn't disprove the case $p=5$ that you checked, because in this case $h=2$.
Second remark: It is possible to "single out" the principal ideals, by using the character group of the ideal class group. Let $G$ be the character group of $\text{Cl}(\mathcal O_K)$. Given an element $\eta\in G$, we define the $L$-function 
$$L(\eta, s) = \sum_{I\subseteq O_K}\frac{\eta([I])}{\|I\|^s},$$
where $[I]$ denotes the ideal class of $I$. Then, by the usual orthogonality relations for characters, for any ideal class $\mathfrak c$ we have
$$L(\mathfrak c, s) = \frac{1}{h}\sum_{\eta \in G}\eta(\mathfrak c)^{-1}L(\eta, s).$$
In particular, if $|\mathcal O_K^\times| = w < \infty$, we have the nice formula
$$\sum_{\alpha \in \mathcal O_k}N(\alpha)^{-s} = \frac{w}{s} \sum_{\eta \in G}L(\eta, s).$$
