The standard proof is that this follows from the Taylor series
$$\arctan x = x - \frac{x^3}{3} + \frac{x^5}{5} \mp ...$$
for the arctangent. This Taylor series is closely related to the Taylor series of the logarithm
$$\log (1 + x) = x - \frac{x^2}{2} + \frac{x^3}{3} \mp ...$$
and this is because the tangent function can be written in terms of complex exponentials, so the arctangent function can be written in terms of complex logarithms. So the appearance of $\pi$ in this formula is morally due to Euler's formula.
But there is also the following beautiful proof, which I learned from Gabor Toth's Glimpses of Algebra and Geometry. Consider the number $N(r)$ of integer lattice points inside the circle of radius $r$ centered at the origin, or in other words the number of pairs of integers $x, y$ satisfying $x^2 + y^2 \le r^2$. It is not hard to see that $N(r) \sim \pi r^2$ for large $r$; in fact, it is not hard to see that $N(r) = \pi r^2 + O(r)$.
Let $r_2(n)$ denote the number of pairs of integers $(x, y)$ such that $x^2 + y^2 = n$. Then $N(r) = 1 + r_2(1) + ... + r_2(r^2)$ (if $r$ is an integer). On the other hand, a classic result of number theory implies that
$$r_2(n) = 4(d_1(n) - d_3(n))$$
where $d_k(n)$ is the number of divisors of $n$ congruent to $k \bmod 4$. It follows that we can evaluate $N(r)$ by counting how many numbers between $1$ and $r^2$ are divisible by each number congruent to $1, 3 \bmod 4$ with the appropriate sign. This gives
$$\frac{N(r) - 1}{4} = r^2 - \left\lfloor \frac{r^2}{3} \right\rfloor + \left\lfloor \frac{r^2}{5} \right\rfloor \mp ...$$
and the result follows by taking the limit as $r \to \infty$.