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$.