Here is an approach.
We may use the following result, which goes back to G. Boole (1857) :
$$
\int_{-\infty}^{+\infty}f\left(x-\frac{a_1}{x-\lambda_1}-\cdots-\frac{a_n}{x-\lambda_n}\right)\mathrm{d}x=\int_{-\infty}^{+\infty} f(x)\: \mathrm{d}x \tag1
$$
with $a_i>0, \lambda_i \in \mathbb{R}$ and $f$ sufficiently 'regular'.
Observe that, for $x\neq n\pi$, $n=0,\pm1,\pm2,\ldots$, we have $$ \cot x = \lim_{N\to +\infty} \left(\frac1x+\frac1{x+\pi}+\frac1{x-\pi}+\cdots+\frac1{x+N\pi}+\frac1{x-N\pi}\right)$$ leading to (see Theorem 10.3 p. 14 here and see achille's answer giving a route to prove it)
$$
\int_{-\infty}^{+\infty}f\left(x-\cot x\right)\mathrm{d}x=\int_{-\infty}^{+\infty} f(x)\: \mathrm{d}x \tag2
$$
with $\displaystyle f(x)=\frac{1}{1+\left(\small{\dfrac\pi2 -x }\right)^2}$.
On the one hand, from $(2)$,
$$
\begin{align}
\int_{-\infty}^{+\infty}f\left(x-\cot x\right)\mathrm{d}x& =\int_{-\infty}^{+\infty} f(x)\: \mathrm{d}x \\\\
&=\int_{-\infty}^{+\infty}\frac{1}{1+\left(\small{\dfrac\pi2 -x }\right)^2}\: \mathrm{d}x\\\\
&=\int_{-\infty}^{+\infty}\frac{1}{1+x^2}\: \mathrm{d}x\\\\
& =\pi \tag3
\end{align}
$$
On the other hand, with the change of variable $x \to \dfrac\pi2 -x$,
$$
\begin{align}
\int_{-\infty}^{+\infty}\!\!\!f\left(x-\cot x\right)\mathrm{d}x & =\int_{-\infty}^{+\infty} \!\!\!f\left(\dfrac\pi2-x-\tan x\right)\mathrm{d}x \\\\
& =\int_{-\infty}^{+\infty}\frac{1}{1+\left(x+ \tan x \right)^2} \mathrm{d}x \tag4
\end{align}
$$
Combining $(3)$ and $(4)$ gives
$$
\int_{-\infty}^{+\infty}\frac{1}{1+\left(x+ \tan x \right)^2} \mathrm{d}x=\pi.
$$
Hint. You may write
$$
\begin{align}
\int_{-1}^4 (3-|2-x|)\, dx &=\int_{-1}^2 (3-|2-x|)\, dx+\int_2^4 (3-|2-x|)\, dx\\\\
&=\int_{-1}^2 (3-(2-x))\, dx+\int_2^4 (3-(-(2-x)))\, dx \\\\
&=\int_{-1}^2 (1+x)\, dx+\int_2^4 (5-x)\, dx \\\\
&= ...
\end{align}
$$ where we have used
$$
|u| =
\begin{cases}
-u, & \text{if $u \leq 0$} \\
u, & \text{if $u \geq 0$.}
\end{cases}
$$
I think you can take it from here.
Addendum: I've change the lower bound, as you changed it:)
Best Answer
There are three regions:
$$\int_{-1}^{2} (|x|+|1-x|) dx=\int_{-1}^{0}-2x+1 \ dx +\int_{0}^{1}1\ dx+\int_{1}^{2}2x-1 \ dx=5.$$
To verify this, take a look at the following figure: