At this point on the presentation the Leibniz formula:
$$1- \frac 1 3 + \frac 1 5 - \frac 1 7+\cdots= \frac \pi 4$$
is expressed with "a few lines of calculus" as
$$\begin{align} 1- \frac 1 3 + \frac 1 5 - \frac 1 7+\cdots & =\int_0^1 \left(1 - x^2 + x^4 - \cdots \right) dx \tag 1\\[2ex] &=\int_0^1 \frac{1}{1+x^2}dx \tag 2\\[2ex] &=\tan^{-1}(1) \tag 3\\[2ex] &=\frac \pi 4 \end{align}$$
For $(1)$ my reasoning would be to just notice that integration is linear, so we end up with an infinite sum of integrals as in
$$\begin{align} 1+\sum_{n=1}^\infty (-1)^{n} \int_0^1 x^{2n} dx &= \left. \frac{x^{2n+1}}{2n+1} \right|_{x=1}\\[2ex] &=1+\sum_{n=1}^\infty (-1)^{n}\frac{1}{2n+1}=\frac \pi 4 \end{align}$$
$(2)$ can be expanded to $(1)$ with polynomial long division, or recognizing it as the generating function or the Taylor series of the integrand in $(1).$
Finally, $(3)$ is just integration.
My question is whether there is a more "elegant" way of justifying equalities $(1)$ and $(2).$
As pointed out by @Quotable, one way to think of this is infinite Geometric Progression, with the first term as $1$ and the common ratio as $-x^2$.
Another way could be the binomial expansion of $(1+x^2)^{-1}$.
$$(1+x)^{n}=1+nx +\frac{(n)(n-1)}{2!}x^2 +\frac{(n)(n-1)(n-2)}{3!}x^3 \cdots$$ Substitute $x^2$ in place of $x$ and $-1$ in place of $n$.