I found the following proof online for Leibniz's formula for $\pi$:
$$\frac{1}{1-y}=1+y+y^2+y^3+\ldots$$ Substitute $y=-x^2$:
$$\frac{1}{1+x^2}=1-x^2+x^4-x^6+\ldots$$
Integrate both sides:
$$\arctan(x)=x-\frac{x^3}{3}+\frac{x^5}{5}-\frac{x^7}{7}+\ldots$$
Now plug in $1$ for $x$:
$$\frac{\pi}{4}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\ldots$$
The thing I am confused about is that the Taylor expansion for $\frac{1}{1-y}$ only works for $-1<y<1$. Why is this still a legitimate proof? At the end, we compute the integral of both sides to $y=-1$.
Here is a less hand-wavey formulation of what they're saying (as far as I can tell): We have two functions $f, g:(-1, 1) \to \Bbb R$ given by $$ f(x) = \frac1{1+x^2}\\ g(x) = 1-x^2 + x^4 - x^6 + \cdots $$ an they happen to be equal. Note that for any $a \in (-1,1)$, this means that $$ \left(\vphantom{\int}\arctan(a) =\right) \int_0^a f(x)\, dx = \int_0^ag(x)\,dx\left( = a - \frac{a^3}{3} + \frac{a^5}{5} - \frac{a^7}{7} + \cdots \right) $$ Now take the limit as $a \to 1$ on both sides. The left side clearly becomes $\arctan(1)$, while the right side seems to become $1-\frac13+\frac15+\cdots$. The fact that it indeed does needs a theorem in its own right, and is addressed other answers.