Clearly, the Mellin transform identity for $\cos$ is valid only when $0<\Re s<1$. Hence, we are forced to choose $c\in (0,1)$ for Mellin inverse.
Let’s first solve for $u(x)$ when $0<x<1$.
In this case, the integrand decays exponentially on the left half plane due to $x^s=e^{(\ln x)s}$. Hence, we choose a contour from $c-i\infty$ to $c+i\infty$, and close the contour by attaching a infinitely big semicircle on its left.
Obviously, the integral over the arc vanishes. Therefore, by residue theorem, the Mellin inverse equals
$$\sum\text{residues of $x^{-s}\csc\frac{\pi s}2$ on the left half plane}$$
Note that singularities enclosed are simple poles and are at $s=-2n$, $n=0,1,2,\cdots$. The residue is
$$x^{2n}\lim_{s\to -2n}(s+2n)\csc\frac{\pi s}2=\frac{2}{\pi}(-1)^n x^{2n}$$
Summing the residue from $n=0$ to $\infty$, we found that the Mellin inverse is
$$u(x)=\frac{2}{\pi}\frac{1}{x^2+1}$$
It is (un)surprising that we get the same result for $x>1$ (semicircle on the right half plane) - this is an instance of analytic continuation. Hence, we conclude that $\frac{2}{\pi}\frac{1}{x^2+1} $ is the solution of $u(x)$ for all $x>0$.
Note that this question is highly similar to another one I recently answered. The two different solutions are respectively the real and imaginary parts of $\frac 2\pi \frac1{1-ix}$, depending on whether it is a $\cos$ or a $\sin$.
Consider the multivariable Fourier transformation in more detail. i.e., Fourier transformation of $f(x_1, \cdots, x_n)$ into $\mathcal{F}(f)(\zeta_1, \cdots, \zeta_n)$ is given by
\begin{align}
\mathcal{F}(f) = \int e^{-2 \pi i (\sum_i x_i \zeta_i)} f(x_1, \cdots, x_n) dx_1 \cdots dx_n
\end{align}
From
\begin{align}
\mathcal{M}[f(x);s=a+2 \pi ib] = \mathcal{F}[f(e^{-x})e^{-ax};b]
\end{align}
with the comment of @reuns, extend $s$ to $\vec{s}$
\begin{align}
\mathcal{M}[f(x_1, \cdots, x_n);\vec{s}] = \mathcal{F}[f(e^{-x_1}, e^{-x_2}, \cdots, e^{-x_n}) ; \vec{b}]
= \int_{-\infty}^{\infty} f(e^{-x_1}, \cdots, e^{-x_n}) e^{-\vec{s} \cdot \vec{x}} dx_1 \cdots dx_n
\end{align}
Now back to $t$, for one variatble case using $t=e^{-x}, dt = - e^{-x}$, I have $\int_{0}^{\infty} f(t) t^{s-1} dt$, hence
\begin{align}
\mathcal{M}[f(x_1, \cdots, x_n);\vec{s}] = \int_0^{\infty} f(t_1, \cdots, t_n) t_1^{s_1 -1} \cdots t_n^{s_n-1} dt_1 \cdots dt_n
\end{align}
and similar arguement can be applied to inverse Mellin as well. i.e.,
the inverse Mellin transformation can be achieved via
\begin{align}
f(t_1, \cdots, t_n) = (\frac{1}{2 \pi i})^n \int_{a_n - i \infty}^{a_n + i\infty} \cdots \int_{a_1 - i \infty}^{a_1 + i\infty} F(s_1, \cdots, s_n) t_1^{-s_1} \cdots t_n^{-s_n} ds_1 \cdots ds_n
\end{align}
where the integration is along a vertical line through $\operatorname{Re}[s_i]=a_i$.
Best Answer
Mellin inversion is Fourier inversion in different coordinates. Although the assertion is not completely trivial, I have not seen any way to reduce this to complex-variable ideas, e.g., Cauchy's theorems and immediate corollaries. Rather, to my mind, the sane proof of Fourier inversion is proof with a Gaussian inserted to tweak things, for Schwartz functions, then extend by continuity upon observing Plancherel's identity.
In several regards one might perceive Fourier inversion (or questions about Fourier series, similarly, recovering the original function) as facts at a level of profundity "higher" than Leibniz-Newton (note the alphabetical order of authors) calculus, and "higher" than Cauchy's complex function-theory.
For reasons that I have yet to understand, people in the 19th century did believe the inversion formula for Fourier transform... with disclaimers. Dirichlet proved pointwise convergence of Fourier series (under hypotheses) early on... Similarly, people seemed to believe "Mellin inversion", despite not having a general argument, and perhaps despite not feeling that this was equivalent to Fourier inversion, since "change-of-coordinates" issues were (by far) not explicit, and (therefore) not easily understandable in the parlance of the times.
In summary: "Mellin inversion" is a changed-coordinates version of Fourier (transform) inversion, perhaps adding some analytic-continuation stuff... which in delicate circumstances can be highly meaningful... but, on most days, maybe everything is "just what it seems".