There are 2 common proofs of Leibniz formula $\frac{\pi}{4}=\sum_{n=0}^{\infty}(-1)^{n}(2n+1)^{-1}=\frac{1}{1}-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\ldots$
Calculus proof:
The first come by studying the power series $\sum_{n=0}^{\infty}(-x)^{n}(2n+1)^{-1}=\frac{x^{1}}{1}-\frac{x^{3}}{3}+\frac{x^{5}}{5}-\frac{x^{7}}{7}+\ldots$ and then "take the limit $x\rightarrow 1^{-}$" (apply Abel's theorem).
The proof proceed by differentiating, then recognize that this is a geometric series, and then integrating again, it can be shown that this is just the Taylor's series of $\arctan$.
This is a well-known in calculus. Leibniz's original geometric argument can be easily related to it: he basically showed, by drawing circle and chord, something that (after an algebraic manipulation) is equivalent to $\frac{d\arctan(x)}{dx}=\frac{1}{1+x^{2}}$, a result much more easily obtained now using the more general theorem about inverse function theorem, or trig substitution, after knowing the derivative of $\tan$. Circles even show up here due to trigonometric functions.
Number theory proof:
The second proof come by studying the Dirichlet series $\sum_{n=0}^{\infty}(-1)^{n}(2n+1)^{-s}=\frac{1}{1^{s}}-\frac{1}{3^{s}}+\frac{1}{5^{s}}-\frac{1}{7^{s}}+\ldots$ and then "take the limit $s\rightarrow 1^{+}$" (perform analytic continuation to $Re(s)>\frac{1}{2}$).
The proof proceed by showing that $2(\sum_{n=0}^{\infty}(-1)^{n}(2n+1)^{-s})(\sum_{z\in\mathbb{Z}\backslash\{0\}}|z|^{-s})=\sum_{z\in\mathbb{Z[i]}\backslash\{0\}}(|z|^{2})^{-s}$. This can be shown from the following number theory fact: $r_{2}(n)=4(d_{1}(n)-d_{3}(n))$. Here $r_{2}(n)$ that the number of ways to write a positive integer $n$ as a sum of 2 squares, counting swapping position as distinct, counting negative numbers squared as distinct, basically counting all possible ordered pair of integers $(a,b)$ such that $a^{2}+b^{2}=n$. And $d_{1}(n)$ the number of positive divisors of $n$ that are $1(\mod 4)$, $d_{3}(n)$ the number of positive divisors of $n$ that are $3(\mod 4)$. This number-theoretic fact can be proved from Fermat's theorem about which prime can be written as the sum of 2 squares, and the fact that $\mathbb{Z}[i]$ is an Euclidean domain (since it forms a lattice).
Once the equation $2(\sum_{n=0}^{\infty}(-1)^{n}(2n+1)^{-s})(\sum_{z\in\mathbb{Z}\backslash\{0\}}|z|^{-s})=\sum_{z\in\mathbb{Z[i]}\backslash\{0\}}(|z|^{2})^{-s}$ is known, taking limit is easy. $\lim_{s\rightarrow 1^{+}}\frac{1}{2}\frac{\sum_{z\in\mathbb{Z[i]}\backslash\{0\}}(|z|^{2})^{-s}}{\sum_{z\in\mathbb{Z}\backslash\{0\}}|z|^{-s}}$ can be computed by replacing the numerator and denominator by a continuous approximation $\lim_{s\rightarrow 1^{+}}\frac{1}{2}\frac{\int_{z\in\mathbb{C}\backslash\{0\}}(|z|^{2})^{-s}dz}{\int_{z\in\mathbb{R}\backslash\{0\}}|z|^{-s}dz}$, and change to polar coordinate this is just $\frac{1}{2}\frac{\pi\int_{r\in\mathbb{R}^{+}}r^{-s}dr}{2\int_{r\in\mathbb{R}^{+}}r^{-s}dr}$. So we obtain the result. Circles even show up as polar coordinate.
Question:
So while both proof has some similarities: they both extend the original question into a generating function, using some counting facts to relate it to other functions, and circles actually show up. Conceptually the 2 proofs are still very different, or at least seems to be.
So my question is this. Is there a deeper connection behind the scene of these 2 proofs that I did not know about? Is there some sort of "bijective" transformation of one proof into another? Or are they just so completely different that there are no ways?
EDIT: forgot to mention this, but this observation is obvious. In the number theory proof we use $\mathbb{Z}[i]$, while in the calculus proof we use $\frac{1}{x^{2}+1}$. But $i$ is the root of $x^{2}+1$.
I think it's pretty clear that they are different proofs. To see this, you can do exactly the same two calculations except now replacing (more or less) the ring of integers of $\mathbf{Q}(\sqrt{-1})$ by the ring of integers of $\mathbf{Q}(\sqrt{-D})$ for some fundamental discriminant $D$. The first argument comes down to computing a sum
$$\sum_{n=1}^{\infty} \frac{\chi(n)}{n}$$
for an odd quadratic Dirichlet character $\chi$ of conductor $D$. You can clearly compute this in terms of standard integrals (and Dirichlet did this), and you get a rational multiple of $\pi/\sqrt{|D|}$.
The second argument comes down to computing the value of $\zeta_{K}(s)/\zeta_{\mathbf{Q}}(s)$ for the field $K = \mathbf{Q}(\sqrt{-D})$ at $s = 1$. If you repeat the same argument, you again get a rational multiple of $\pi/\sqrt{|D|}$, except now because you don't have unique factorization (in general) for the ring of integers of $K$, a factor $h_{K}$ which is the class number of $K$ intervenes. For example, if $-D = -p$ with $p \equiv 3 \pmod 4$ is prime, Dirichlet proved the two calculations together give (for $p \ne 3$) the class number formula:
$$h_K = \frac{-1}{p} \sum_{n=1}^{p-1} n \left(\frac{n}{p}\right)$$
Summary: Usually when two calculations are "the same" you can't extract any useful information from having both of them. But these two calculations give a formula for the class number. In your specific proof, you can turn both computations into a proof that $\mathbf{Q}(\sqrt{-1})$ has class number one, e.g. unique factorization in $\mathbf{Z}[\sqrt{-1}]$.