An arctan series with a parameter $\sum_{n=1}^\infty \arctan \left(\frac{2a^2}{n^2}\right)$ I'm trying to evaluate $$\sum_{n=1}^\infty \arctan \left(\frac{2a^2}{n^2}\right) \ , \ a >0. $$
The answer I get only seems to be correct for small values of $a$. 
What accounts for this?
Using the principal branch of the logarithm, I get
$$
\begin{align}
&  \sum_{n=1}^\infty \arctan \left(\frac{2a^2}{n^2}\right) \\ & =  \text{Im} \sum_{n=1}^\infty \log \left( 1 + \frac{2ia^2}{n^2} \right) \\
& = \text{Im} \log \prod_{n=1}^\infty \left(1 + \frac{2ia^2}{n^2} \right) \\ 
& = \text{Im} \log \prod_{n=1}^\infty \left(1 - \frac{(\sqrt{-2i}a)^2}{n^2} \right) \\
& =\text{Im} \log \left(\frac{\sin (\pi \sqrt{-2i}a)}{\pi \sqrt{-2i}a} \right) \\
& = \text{Im} \log \left(\frac{\sin \left(\pi (1-i)a\right)}{\pi (1-i)a} \right) \\
& = \text{Im} \log \left(\frac{\sin (\pi a) \cos (i\pi a) - \cos (\pi a) \sin (i \pi a)}{\pi (1-i)a} \right) \\
& = \text{Im} \log \left(\frac{\sin (\pi a) \cosh (\pi a) - i\cos (\pi a) \sinh (\pi a)}{\pi (1-i)a} \right) \\ 
& = \text{Im} \log \left(\frac{\sin (\pi a) \cosh (\pi a) + \cos(\pi a) \sinh (\pi a) + i \left( \sin (\pi a) \cosh (\pi a) -  \cos (\pi a) \sinh ( \pi a) \right)}{2\pi a} \right) \\
& = \text{Arg} \  \Big(\sin (\pi a) \cosh (\pi a) + \cos(\pi a) \sinh (\pi a)+ i \left( \sin (\pi a) \cosh (\pi a) -   \cos (\pi a) \sinh ( \pi a) \right) \Big)
\end{align}
$$
 A: I think I understand the issue now. In this setting, we cannot say that $\log(A)+\log(B)$ is equal to $\log(AB)$. This (generally) invalidates your exchange of an infinite sum for an infinite product. But keep reading to the end to see a fix.
Let's write $\log$ for the principle branched logarithm, and $\operatorname{lug}$ for a potentially different branched logarithm. For fixed $A$ and $B$, there is some $\operatorname{lug}$ for which $$\log(A)+\log(B)=\operatorname{lug}(AB)$$ but it might have a different branch.
Consider $A=B=\exp(i3\pi/4)$. Then 
$$\begin{align}\log(A)+\log(B)&=i3\pi/4+i3\pi/4\\&=i3\pi/2\end{align}$$ But this addition has crossed over the negative real axis in an angular sense. So $\log(AB)$ is something different: $$\log(AB)=\log(\exp(i3\pi/2))=-i\pi/2$$
So it is not exactly that some values of $a$ cause a problem with your first line, but rather with your second line. If $a$ is small enough such that the infinite summation in the first line never surpasses $\pi i$, then the final result should be OK. For other $a$, you would want to find how many times that sum crossed the negative reals in an angular sense, and account for so many multiples of $2\pi i$.
$\operatorname{Arg}$ is discontinuous at $x+iy$ with negative $x$ and $y=0$. The discontinuities in $\operatorname{Arg}$ in your final line will correspond to values of $a$ where the original sum passes $\pi$, $3\pi$, etc. So let's solve for when the imaginary part of the input to $\operatorname{Arg}$ in your final line equals zero.
$$\begin{align}
\sin(\pi a)\cosh(\pi a)−\cos(\pi a)\sinh(\pi a) & = 0\\
\sin(\pi a)\cosh(\pi a)&=\cos(\pi a)\sinh(\pi a)\\
\tan(\pi a)&=\tanh(\pi a)
\end{align}
$$
The positive solutions to this equation can be solved numerically: $a\approx1.249\ldots,2.249\ldots,3.250\ldots,4.25\ldots$. Only every other solution actually corresponds to a discontinuity in $\operatorname{Arg}$, since we also require the real part of the input to $\operatorname{Arg}$ in your final line to be negative.
So rounding just a little, your result is valid as is for $|a|<a_0=1.25$. After that, we can count how many times the original sum has passed $\pi$, $3\pi$, $5\pi$, $\ldots$ with $\left\lceil\frac{a-a_0}{2}\right\rceil$. So to your result, let's add $2\pi\left\lceil\frac{a-a_0}{2}\right\rceil$. Of course, there has been some rounding here, so this won't always be right for values of $a$ very near to the critical $a$ values $\approx 1.25, 3.25, 5.25\ldots$.
