Squared modulus of Dirichlet eta function. I have a problem:

Find formula for $|\eta(x+iy)|^{2}$, where $\eta(x+iy)=\sum_{n\ge1}\frac{(-1)^{n-1}}{n^{x+iy}}$

I calculated it in two ways and i got a contradiction.


*

*First method: $|\eta(x+iy)|^{2}=\eta(s)\eta(s)^{c}=\eta(s)\eta(s^{c})=\sum_{n\ge1}\frac{\sum_{d|n}(-1)^{d+\frac{n}{d}}(\frac{n}{d^{2}})^{-iy}}{n^{x}}=:A$
where $c$ stands for complex conjugation.


*

*Second method: $|\eta(x+iy)|^{2}=(\Re(\eta(x+iy)))^{2}+(\Im(\eta(x+iy)))^{2}=\sum_{n\ge1}\frac{\sum_{d|n}(-1)^{d+\frac{n}{d}}\cos(y\ln \frac{n}{d^{2}})}{n^{x}}=:B$
But $A$ is not equal to $B$.
What did i do wrong?
 A: I believe you are going about this in the wrong way. It is well-known that the series for your function defined the alternating zeta function for $\Re(s) \geq 1$: 
$$\eta(s) \equiv \zeta^{\ast}(s) = \begin{cases} 
     \log(2), & s = 1; \\ 
     (1-2^{1-s}) \zeta(s), & \Re(s) > 1. 
\end{cases}$$
The easiest way to see this is to break the series for $\eta(s)$ up into cases where the term $(-1)^{n} \mapsto \pm 1$, i.e., we have that 
$$\sum_{n \geq 1} (-1)^{n-1} n^{-s} = \sum_{n \geq 1} (2n-1)^{-s} - \sum_{n \geq 1} (2n)^{-s}.$$ Then we can add and subtract a copy of the rightmost sum in the previous equation to obtain that 
$$\eta(s) = \zeta(s) -2 \cdot \sum_{n \geq 1} (2n)^{-s} = (1-2^{1-s}) \cdot \zeta(s).$$ Piece of cake with this observation, right? 
As it happens, more in the spirit with what you were going for, there's a mean value formula for Dirichlet series found in Apostol's book:
$$\lim_{T \rightarrow \infty} \frac{1}{2T} \int_{-T}^{T} F(a+\imath t) G(b-\imath t) dt = \sum_{n \geq 1} \frac{f(n) g(n)}{n^{a+b}},$$ 
where $F(s),G(s)$ are respectively the Dirichlet series over $f(n), g(n)$ which are absolutely convergent at (resp.) the points $a,b \in \mathbb{R}$.
