Provide us a detailed explanation to calculate the Mellin transform of a cosine function, and get the closed form of a related sum I would like to know how define and compute the Mellin transform (see the definition of previous integral transform in the Wikipedia's article) of $\cos\left(2\pi\frac{k}{n}x\right)$. My genuine problem is consider the Möbius function expressed as 
$$\mu(n)=\sum_{\substack{(k,n)=1\\1\leq k\leq n}}\cos\left(2\pi\frac{k}{n}\right),$$ then I am interested in calculate the Mellin transform of the following related function, here thus $n\geq 1$ is a fixed integer, $$f_{n}(x)=\sum_{\substack{(k,n)=1\\1\leq k\leq n}}\cos\left(2\pi\frac{k}{n}x\right)$$ as $$\left\{ \mathcal{M}  f_n\right\}(s)=\sum_{\substack{(k,n)=1\\1\leq k\leq n}}\int_0^\infty x^{s-1}\cos\left(2\pi\frac{k}{n}x\right)dx,$$ using that this integral transform is linear. 

Question 1. Can you explain how get easily the Mellin transform of one of the summands, thus $$\int_0^\infty x^{s-1}\cos\left(2\pi\frac{k}{n}x\right)dx?$$ Where is defined the integral transform? (I say where is defined the result.)

After, 

Question 2. Can you state the more simplified form (if there are  simplifications to get the sum) for $$\left\{ \mathcal{M}  f_n\right\}(s)?$$ Thanks in advance.

 A: Let $a=\frac{k}{n}$ for $k,n \in \mathbb{N}$
\begin{equation}
\int\limits_{0}^{\infty} x^{s-1} \cos(2\pi a x) \mathrm{d}x
= \frac{1}{2} \int\limits_{0}^{\infty} x^{s-1} \mathrm{e}^{ia2\pi x} + x^{s-1} \mathrm{e}^{-ia2\pi x} \mathrm{d}x
\end{equation}
The first integral:
\begin{align}
\int\limits_{0}^{\infty} x^{s-1} \mathrm{e}^{ia2\pi x} \mathrm{d}x
&= \left(\frac{-1}{ia2\pi}\right)^{s} \int\limits_{0}^{\infty} y^{s-1} \mathrm{e}^{-y} \mathrm{d}y \\
&= \left(\frac{-1}{ia2\pi}\right)^{s} \Gamma(s) \\
&= \frac{1}{(a2\pi)^{s}} \Gamma(s) \mathrm{e}^{is\pi/2}
\end{align}
The second integral:
\begin{align}
\int\limits_{0}^{\infty} x^{s-1} \mathrm{e}^{-ia2\pi x} \mathrm{d}x
&= \frac{1}{(ia2\pi)^{s}} \int\limits_{0}^{\infty} y^{s-1} \mathrm{e}^{-y} \mathrm{d}y \\
&= \frac{1}{(ia2\pi)^{s}} \Gamma(s) \\
&= \frac{1}{(a2\pi)^{s}} \Gamma(s) \mathrm{e}^{-is\pi/2}
\end{align}
Thus,
\begin{align}
\int\limits_{0}^{\infty} x^{s-1} \cos(2\pi a x) \mathrm{d}x
&= \frac{1}{2} \Big[\frac{1}{(a2\pi)^{s}} \Gamma(s) \mathrm{e}^{is\pi/2} + 
\frac{1}{(a2\pi)^{s}} \Gamma(s) \mathrm{e}^{-is\pi/2} \Big] \\
&= \frac{1}{(a2\pi)^{s}} \Gamma(s) \cos\left(\frac{s\pi}{2}\right)
\end{align}
Addendum
Here is another solution that avoids the issue addressed in the comment made by user243301.
In Volume 2 of Higher Transcendental Functions (Bateman Manuscript), Section 9.10, Equation 1 we
have a generalization of the fresnel integrals attributed to Bohmer:
\begin{align}
\mathrm{C}(x,a) &= \int\limits_{x}^{\infty} z^{a-1} \cos(z) \mathrm{d}z \\
&= \frac{1}{2} \Big[\mathrm{e}^{i\pi a/2} \Gamma(a,-ix) + \mathrm{e}^{-i\pi a/2} \Gamma(a,ix)\Big]
\end{align}
Thus
\begin{equation}
\mathrm{C}(0,a) = \int\limits_{0}^{\infty} z^{a-1} \cos(z) \mathrm{d}z 
= \Gamma(a) \cos\left(\frac{\pi}{2}a\right)
\end{equation}
For our integral, let $z=2\pi ax$
\begin{equation}
\int\limits_{0}^{\infty} x^{s-1} \cos(2\pi as) \mathrm{d}x 
= (2\pi a)^{-s} \int\limits_{0}^{\infty} z^{s-1} \cos(z) \mathrm{d}z
= (2\pi a)^{-s} \Gamma(s) \cos\left(\frac{\pi}{2}s\right)
\end{equation}
A: According to http://eqworld.ipmnet.ru/en/auxiliary/inttrans/FourCos2.pdf,
$\int_0^\infty x^{s-1}\cos\dfrac{2\pi kx}{n}~dx=\dfrac{n^s\Gamma(s)}{2^s\pi^sk^s}\sin\dfrac{\pi(1-s)}{2}=\dfrac{n^s\Gamma(s)}{2^s\pi^sk^s}\cos\dfrac{\pi s}{2}$
