I will use $a$ instead of $\lambda$, it is simpler to type. Since $a-1$ may take negative values, we may have some problems in $0$, so the contour from the OP avoiding $0$ is needed. The following is valid for
$$
a\ne 1\ .
$$
(For this particular value use an other argument or a posteriori the continuity in $a$.)
Let us denote the two contour pieces $C_1$ and $C_2$ from the OP by $C_1(\epsilon,R)$ and $C_2(\epsilon,R)$, also involving $\epsilon$ and $R$.
The expression $x^a$ is then rather defined as $\exp(a \log x)$ with a branch $\log$ for the logarithm defined to coincide with the real natural logarithm $\ln$ on $(0,\infty)$. So we have for $x>0$ the relation
$$(-x)^{a-1}=(-1)^{a-1}\cdot x^{a-1}=\exp(i\pi\; (a-1))\cdot x^{a-1}\ .$$
So let us compute the integral
$$
\begin{aligned}
J(a)
&:=
\int_0^{\infty}
\dfrac{x^{a -1}}{x^2+1} \;dx
\\
&=\lim_{\substack{0<\epsilon<R\\\epsilon \to0\\R\to\infty}}
\int_\epsilon^\infty
\dfrac{x^{a -1}}{x^2+1} \;dx
=\lim_{\substack{0<\epsilon<R\\\epsilon \to0\\R\to\infty}}
\int_{C_2(\epsilon,R)}
\dfrac{x^{a -1}}{x^2+1} \;dx\ .
\\[3mm]
&\qquad\text{We have:}
\\[3mm]
\int_{-\infty}^0
\dfrac{x^{a -1}}{x^2+1} \;dx
&
=\int_0^{\infty}
\dfrac{(-x)^{a -1}}{x^2+1} \;dx
=e^{i\pi \; a}\cdot
\int_0^{\infty}
\dfrac{(-x)^{a -1}}{x^2+1} \;dx
\\
&=
e^{i\pi\; a}J(a)\ .
\\[3mm]
\left|\int_{C(\epsilon)}
\dfrac{x^{a -1}}{x^2+1} \;dx
\right|
&\le
\int_{C(\epsilon)}
\dfrac{|x|^{a -1}}{|x^2+1|} \;dx
\le
\int_{C(\epsilon)}
\dfrac{\epsilon^{a -1}}{1-\epsilon^2} \;dx
=\pi\epsilon\cdot\dfrac{\epsilon^{a -1}}{1-\epsilon^2}
\\
&\to 0\qquad\text{ because $a>0$.}
\\[3mm]
\left|\int_{C(R)}
\dfrac{x^{a -1}}{x^2+1} \;dx
\right|
&\le
\int_{C(R)}
\dfrac{|x|^{a -1}}{|x^2+1|} \;dx
\le
\int_{C(\epsilon)}
\dfrac{R^{a -1}}{R^2-1} \;dx
=\pi R\cdot\dfrac{R^{a -1}}{R^2-1}
\\
&\to 0\qquad\text{ because $a<2$.}
\\[3mm]
&\qquad\text{This gives:}
\\[3mm]
(1+e^{i\pi\; (a-1)})\cdot J(a)
&=
\lim_{\substack{0<\epsilon<R\\\epsilon \to0\\R\to\infty}}
\int_{C_1(\epsilon,R)\ \sqcup\ C_2(\epsilon,R)}
\dfrac{x^{a -1}}{x^2+1} \;dx
\\
&=
\lim_{\substack{0<\epsilon<R\\\epsilon \to0\\R\to\infty}}
\int_{C_1(\epsilon,R)\ \sqcup \ C(\epsilon)\ \sqcup \ C_2(\epsilon,R)\ \sqcup \ C(R)}
\dfrac{x^{a -1}}{x^2+1} \;dx
\\
&=2\pi\cdot i\sum_{r\text{ Residue}}\operatorname{Res}_{x=r}\dfrac{x^{a -1}}{x^2+1}
\\
&=2\pi\cdot i\cdot \operatorname{Res}_{x=i}\dfrac{x^{a -1}}{x^2+1}
\\
&=2\pi\cdot i\cdot \operatorname{Res}_{x=i}\frac 1{2i}x^{a -1}
\left(\frac 1{x-i}-\frac 1{x+i}\right)
\\
&=2\pi\cdot i\cdot \operatorname{Res}_{x=i}\frac 1{2i}x^{a -1}\cdot \frac 1{x-i}
\\
&=\pi\cdot i^{a-1}=\pi\cdot e^{i\frac \pi 2(a-1)}\ .
\end{aligned}
$$
Now $1+e^{ib}=(1+\cos b)+i\sin b=2\cos ^2\frac b2+2i\sin\frac b2\cos \frac b2=2\cos\frac b2\cdot e^{ib/2}$.
This gives finally:
$$
J(a)
=
\frac
{\pi\cdot \color{blue}{e^{i\frac \pi 2(a-1)}}}
{2\cos\frac \pi 2(a-1)\cdot \color{blue}{e^{i\frac \pi 2(a-1)}}}
=
\frac
\pi
{2\cos\frac \pi 2(1-a)}
=
\frac
\pi
{2\sin\frac {\pi a} 2}
\ .
$$
$\square$