A complex integral which shouldn't diverge, where is my mistake? First of all I have a small request. I was banned for a very long time because I got lazy and formulated my questions without any effort. I accept the punishment and I'm happy I got a second chance. From now on I try to put as much effort in my questions as possible. This is my first question after the ban and it would make me happy if you don't down-vote if you think that my question is not good or not understandable since I'm probably getting banned again. Please write suggestions for improvement in the comments. Thank you and sorry for this way too long introduction. So here we go :)
What do I want to solve?
I want to calculate
$$I = \cfrac{1}{2\pi i}\int \limits_{c-i\infty}^{c+i\infty}\cfrac{\log(s-1)}{s^2}\,x^s \mathrm{d}s,$$
where $c&gt;1$ along the same contour as in &quot;Applications of integral theorems&quot;, example 5: https://en.wikipedia.org/wiki/Contour_integration#Example_5_–_the_square_of_the_logarithm. To implement our integral $I$ we modify our desired closed contour integral to
$$\oint_\mathcal{C}= \left(\int_{R_1}+\int_{R_2}+\int_M+\int_N+\int_r+\int\limits_{c-i\infty}^{c+i\infty}\right)\cfrac{\log(s-1)}{s^2}\,x^s\mathrm{d}s,$$
where$R_1$ ends at $c+i\infty$ and $R_2$ ends at $c-i\infty$.
The whole integral is actually an Inverse laplace transform, if we define $t=\log(x)$. If we put $\frac{\log(s-1)}{s^2}$in this online calculator https://www.emathhelp.net/calculators/differential-equations/inverse-laplace-transform-calculator/?f=ln%28s-1%29%2Fs%5E2 we get $-t\operatorname{Ei}(t)+e^t-1 \Longleftrightarrow-\log x\operatorname{li}(x)+x-1$.
How I tried to solve it
The integrals $R_1,R_2$ and $r$ tend to zero (I use the same notation as in the Wikipedia link). The closed contour is also equal to zero since $0$ is excluded from the contour. After parameterizing $s=-s_\mathcal{R}+i\varepsilon$ for $M$ and $s=-s_\mathcal{R}-i\varepsilon$ for $N$ we get:
$$I + \int\limits_{0}^{\infty}\cfrac{\log\lvert-s_\mathcal{R}+i\varepsilon-1\rvert + i\pi}{(-s_\mathcal{R}+i\varepsilon)^2}\,x^{-s_\mathcal{R}+i\varepsilon}\mathrm{d}s_\mathcal{R}-
    \int\limits_{0}^{\infty}\cfrac{\log\lvert-s_\mathcal{R}+i\varepsilon-1\rvert - i\pi}{(-s_\mathcal{R}-i\varepsilon)^2}\,x^{-s_\mathcal{R}-i\varepsilon}\mathrm{d}s_\mathcal{R} = 0$$
If we now let $\varepsilon\rightarrow0$ we can also evaluate the absolut value. Our new expression is
$$\begin{align}
    I + \int\limits_{0}^{\infty}\cfrac{\log(s_\mathcal{R}+1) + i\pi}{s_\mathcal{R}^2}\,x^{-s_\mathcal{R}}\mathrm{d}s_\mathcal{R}-
    \int\limits_{0}^{\infty}\cfrac{\log(s_\mathcal{R}+1) - i\pi}{s_\mathcal{R}^2}\,x^{-s_\mathcal{R}}\mathrm{d}s_\mathcal{R}
    =0,
\end{align}$$
which is the same as saying that
$$I = -2\pi i\int\limits_{0}^{\infty}\cfrac{1}{x^{s_\mathcal{R}}s_\mathcal{R}^2}\mathrm{d}s_\mathcal{R}$$
And now the disappointment: If I put &quot;integral from 0 to infinity of 1/(a^x*x^2)&quot; into Wolfram Alpha it returns &quot;(integral does not converge)&quot;. I can't find the mistake I did while evaluating. Please give me a small hint what I should correct to get the desired result. Thank you :)!
Edit: I want to thank Maxim for helping me with my question. My mistake was the definition of the branch of $\log(s-1)$. Now I (only) have to solve
$$\lim_{\varepsilon\to0}\left(\int\limits_{0}^{\infty}\cfrac{\log\lvert-s_\mathcal{R}+i\varepsilon-1\rvert + i\pi}{(-s_\mathcal{R}+i\varepsilon)^2}\,x^{-s_\mathcal{R}+i\varepsilon}\mathrm{d}s_\mathcal{R}-
    \int\limits_{0}^{\infty}\cfrac{\log\lvert-s_\mathcal{R}+i\varepsilon-1\rvert - i\pi}{(-s_\mathcal{R}-i\varepsilon)^2}\,x^{-s_\mathcal{R}-i\varepsilon}\mathrm{d}s_\mathcal{R}\right),$$
what could get a little bit hard since I'm not allowed to set $\varepsilon$ to $0$ immediatly.
$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
The integral $\ds{\underline{vanishes\ out}}$ when
$\ds{\underline{\Re\pars{\ln\pars{x} &lt; 0}}}$.

When $\ds{\underline{\Re\pars{\ln\pars{x} &gt; 0}},\quad}$ lets $\ds{\tau \equiv \ln\pars{x} &gt;0 }$
\begin{align}
I &amp; \equiv \bbox[5px,#ffd]{\left.%
\int_{c - \ic\infty}^{c + \ic\infty}\
{\ln\pars{s - 1} \over s^{2}}\expo{\tau s}
{\dd s \over 2\pi\ic}\,\right\vert_{\substack{c\ &gt;\ 1
\\[2mm] \Re\pars{\tau\ \equiv\ \ln\pars{x}}\ &gt;\ 0}}}
\\[5mm] &amp; =
-\int_{-\infty}^{1}\
{\ln\pars{1 - s} + \ic\pi \over
\pars{s + \ic 0^{+}}^{2}}\expo{\tau s}{\dd s \over 2\pi\ic}
\\[2mm] &amp; \,\,\,\,-
\int_{1}^{-\infty}\
{\ln\pars{1 - s} - \ic\pi \over
\pars{s - \ic 0^{+}}^{2}}\expo{\tau s}{\dd s \over 2\pi\ic}
\\[5mm] &amp; =
-\int_{-1}^{\infty}\
{\ln\pars{1 + s} + \ic\pi \over
s^{2} - \ic\on{sgn}\pars{s}\,0^{+}}
\expo{-\tau s}{\dd s \over 2\pi\ic}
\\[2mm] &amp;\,\,\,\,\,\,\, -
\int_{-1}^{\infty}\
{\ln\pars{1 + s} - \ic\pi \over
s^{2} + \ic\on{sgn}\pars{s}\,0^{+}}
\expo{-\tau s}{\dd s \over 2\pi\pars{-\ic}}
\\[5mm] &amp; =
-2\,\Re\int_{-1}^{\infty}\
{\ln\pars{1 + s} + \ic\pi \over
s^{2} - \ic\on{sgn}\pars{s}\,0^{+}}
\expo{-\tau s}{\dd s \over 2\pi\ic}
\\[5mm] &amp; =
-{1 \over \pi}\,\Im\int_{-1}^{\infty}\
{\ln\pars{1 + s} - \ic\pi \over
s^{2} - \ic\on{sgn}\pars{s}\,0^{+}}
\expo{-\tau s}\dd s
\\[5mm] &amp; =
-{1 \over \pi}\,\Im\left\{%
\mrm{P.V.}\int_{-1}^{\infty}\
{\ln\pars{1 + s} - \ic\pi \over s^{2}}
\expo{-\tau s}\dd s
\right.
\\[2mm] &amp;\ \left.%
+ \int_{-1}^{\infty}
\bracks{\ln\pars{1 + s} - \ic\pi}\expo{-\tau s}
\bracks{\ic\pi\on{sgn}\pars{s}\,\delta\pars{s^{2}}}\,\dd s\right\}
\\[5mm] &amp; =
\mrm{P.V.}\int_{-1}^{\infty}{\expo{-\tau s} \over s^{2}}\,\dd s
-
{1 \over 2}
\int_{-1}^{\infty}{\ln\pars{1 + s} \over s}
\expo{-\tau s}\,\delta\pars{s}\,\dd s
\\[5mm] &amp; =
2\ \underbrace{\int_{0}^{1}
{\cosh\pars{\tau s} \over s^{2}}\,\dd s}
_{\ds{\color{red}{\mbox{It diverges !!!}}}}
\\[2mm] &amp; +\
\underbrace{\int_{1}^{\infty}{\expo{-\tau s} \over s^{2}}\,\dd s}
_{\ds{{1 \over x} - \ln\pars{x}\on{E}_{1}\pars{\ln\pars{x}}}}\
-\ {1 \over 2}
\end{align}
$\ds{\on{E}_{1}}$ is the
Exponential Integral Function.
$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
The integral $\ds{\underline{vanishes\ out}}$ when
$\ds{\underline{\Re\pars{\ln\pars{x} &lt; 0}}}$.

When $\ds{\underline{\Re\pars{\ln\pars{x} &gt; 0}},\quad}$ lets $\ds{\tau \equiv \ln\pars{x} &gt;0 }$
\begin{align}
I &amp; \equiv \bbox[5px,#ffd]{\left.%
\int_{c - \ic\infty}^{c + \ic\infty}\
{\ln\pars{s - 1} \over s^{2}}\expo{\tau s}
{\dd s \over 2\pi\ic}\,\right\vert_{\substack{c\ &gt;\ 1
\\[2mm] \Re\pars{\tau\ \equiv\ \ln\pars{x}}\ &gt;\ 0}}}
\\[5mm] &amp; =
-\int_{-\infty}^{1}\
{\ln\pars{1 - s} + \ic\pi \over
\pars{s + \ic 0^{+}}^{2}}\expo{\tau s}{\dd s \over 2\pi\ic}
\\[2mm] &amp; \,\,\,\,-
\int_{1}^{-\infty}\
{\ln\pars{1 - s} - \ic\pi \over
\pars{s - \ic 0^{+}}^{2}}\expo{\tau s}{\dd s \over 2\pi\ic}
\\[5mm] &amp; =
-\int_{-1}^{\infty}\
{\ln\pars{1 + s} + \ic\pi \over
s^{2} - \ic\on{sgn}\pars{s}\,0^{+}}
\expo{-\tau s}{\dd s \over 2\pi\ic}
\\[2mm] &amp;\,\,\,\,\,\,\, -
\int_{-1}^{\infty}\
{\ln\pars{1 + s} - \ic\pi \over
s^{2} + \ic\on{sgn}\pars{s}\,0^{+}}
\expo{-\tau s}{\dd s \over 2\pi\pars{-\ic}}
\\[5mm] &amp; =
-2\,\Re\int_{-1}^{\infty}\
{\ln\pars{1 + s} + \ic\pi \over
s^{2} - \ic\on{sgn}\pars{s}\,0^{+}}
\expo{-\tau s}{\dd s \over 2\pi\ic}
\\[5mm] &amp; =
-{1 \over \pi}\,\Im\int_{-1}^{\infty}\
{\ln\pars{1 + s} - \ic\pi \over
s^{2} - \ic\on{sgn}\pars{s}\,0^{+}}
\expo{-\tau s}\dd s
\\[5mm] &amp; =
-{1 \over \pi}\,\Im\left\{%
\mrm{P.V.}\int_{-1}^{\infty}\
{\ln\pars{1 + s} - \ic\pi \over s^{2}}
\expo{-\tau s}\dd s
\right.
\\[2mm] &amp;\ \left.%
+ \int_{-1}^{\infty}
\bracks{\ln\pars{1 + s} - \ic\pi}\expo{-\tau s}
\bracks{\ic\pi\on{sgn}\pars{s}\,\delta\pars{s^{2}}}\,\dd s\right\}
\\[5mm] &amp; =
\mrm{P.V.}\int_{-1}^{\infty}{\expo{-\tau s} \over s^{2}}\,\dd s
-
{1 \over 2}
\int_{-1}^{\infty}{\ln\pars{1 + s} \over s}
\expo{-\tau s}\,\delta\pars{s}\,\dd s
\\[5mm] &amp; =
2\ \underbrace{\int_{0}^{1}
{\cosh\pars{\tau s} \over s^{2}}\,\dd s}
_{\ds{\color{red}{\mbox{It diverges !!!}}}}
\\[2mm] &amp; +\
\underbrace{\int_{1}^{\infty}{\expo{-\tau s} \over s^{2}}\,\dd s}
_{\ds{{1 \over x} - \ln\pars{x}\on{E}_{1}\pars{\ln\pars{x}}}}\
-\ {1 \over 2}
\end{align}
$\ds{\on{E}_{1}}$ is the
Exponential Integral Function.