Evaluate the following integral $ \int_1^{\infty} \frac{\lbrace x\rbrace-\frac{1}2}{x} dx$

This function is not integrable in the Lebesgue sense, so you can only evaluate the Cauchy principal value.

That is, what you want to evaluate is the limit $$\lim_{M \rightarrow +\infty} \int_1^M \frac{\{x\}-\frac12}xdx.$$

It is easy to see that it suffices to take the limit for integer values of $M$. We first compute, for every positive integer $k$: $$\int_k^{k + 1}\frac{\{x\}-\frac12}xdx = \int_k^{k + 1}\frac{x- k-\frac12}xdx = 1 - \left(k + \frac 1 2\right) (\ln(k + 1) - \ln k).$$

We then take the sum: $$\int_1^{M + 1} \frac{\{x\}-\frac12}xdx = \sum_{k = 1}^M\left(1 - \left(k + \frac 1 2\right) (\ln(k + 1) - \ln k)\right).$$

This simplifies to: $$M - \left(M + \frac12\right)\ln(M + 1) + \ln M!$$ which, by Stirling's formula, converges to $\ln\frac{\sqrt{2\pi}}e\approx-0.0810614668$.


Not to take away from @Whatsup's clever answer, but I did it another way.

Start with the integral formula, valid for $\Re(s)>0$: $$ \zeta(s) = \frac{s}{s-1} - s\int _1^{\infty}\frac{\{x\}}{x^{s+1}}\,dx $$Introduce the $1/2$ in the integrand: $$ \zeta(s) = \frac{s}{s-1} - s\int _1^{\infty}\frac{\{x\}-1/2+1/2}{x^{s+1}}\,dx $$$$ \zeta(s) = \frac{s}{s-1} - s\int _1^{\infty}\frac{\{x\}-1/2}{x^{s+1}}\,dx - \frac{1}{2} $$Solve for the integral: $$ \int _1^{\infty}\frac{\{x\}-1/2}{x^{s+1}}\,dx = \frac{-2 (s-1) \zeta (s)+s+1}{2 (s-1) s} $$Take the limit as $s\to 0^+$; the LHS exists by Dirichlet's Test and the RHS can be evaluated using L'Hôpital's Rule. $$ \int _1^{\infty}\frac{\{x\}-1/2}{x}\,dx =\lim_{s\to 0^+} \frac{-2 (s-1) \zeta (s)+s+1}{2 (s-1) s} $$ $$ =\lim_{s\to 0^+} \frac{-2 (s-1) \zeta '(s)-2 \zeta (s)+1}{4s-2} $$Using $\zeta(0)=-1/2$ and $\zeta'(0)=-1/2\log(2 \pi)$ as shown here gives the same result. $$ =\lim_{s\to 0^+} \frac{-2 (s-1) (-1/2\log(2 \pi))-2 (-1/2)+1}{4s-2} $$ $$ =1/2\log(2 \pi)-1= \log(\sqrt{2\pi}/e) $$