<s>[INST] Summation of fractional parts of $x/n$ Let us consider the sums  $$\displaystyle T_1(x)=\sum_{n\geq a\sqrt{x}}^{b \sqrt{x}} \left\{ \frac{x}{n} \right\} \\T_2(x)=\sum_{n\geq a\sqrt{x}}^{b \sqrt{x}} \left\{ \frac{x}{2n} \right\}
  $$ where $x$ is a positive integer, $0\leq a<b\leq 1$, $n$ runs over all integers in the interval $[a \sqrt{x}, b\sqrt{x}]$, and $\{ \}$ indicates the fractional part. Because of the equidistribution of such fractional parts, the plots of $T_1(x)$ and $T_2(x)$ versus $x$ show oscillations around the line $\frac{b-a}{2} \sqrt{x}$.
By experimental calculations, I noted that the average value of the difference between $T_1(x)$ (or $T_2(x)$) and $\frac{b-a}{2} \, \sqrt{x}$, calculated over all positive integers $x \leq N$, is $O(1)$. In particular, we have
$$\lim_{N \rightarrow \infty} \frac{1}{N} \sum_{x=1}^{N} \left( T_1(x)- \frac{b-a}{2} \sqrt{x} \right)= K_1(a,b)\\
\lim_{N \rightarrow \infty} \frac{1}{N} \sum_{x=1}^{N} \left( T_2(x)- \frac{b-a}{2} \sqrt{x} \right)= K_2(a,b)$$
where $K_1(a,b)$ and $K_2(a,b)$ are constant terms that depend on $a$ and $b$, indicating that the distributions of such differences are biased. 
The problem can be simplified by considering the case where $b=1$ (once solved this case, the general case with $b<1$ can be solved by difference). In this case, the biases are determined only by $a$. For example, analyzing the distributions of differences over all integers $N$ up to $2500$, setting $a=0.5$ we have $K_1(0.5,1)\approx -0.370...$ and $K_2(0.5,1)\approx -0.169...$, with rather slow convergence rates. I wonder how these terms are generated and whether they could be exactly calculated. Again based on experimental results, it seems that $K_1$ and $K_2$ have a logarithmic relation with $a$, with values near to $\frac{1}{2} \log(a)$ and $\frac{1}{4} \log(a)$, respectively.
This question is somewhat linked to this other one, for which a nice answer was previously given.
EDIT (after Mathworker21's answer): A rough numerical computation until $N=10000$ for the case $a=0.5$, $b=1$ seems to confirm the above estimates obtained with $N$ up to $2500$. Here is the plot of the differences $T_1(x)- \frac{b-a}{2} \sqrt{x}$ versus $x$, followed by that of the average value of these differences calculated over the first $N$ integers. As show in this second plot, $K_1(0.5,1)$ seems to converge to $\approx -0.37$. The dotted black line in the first graph is the best fitting line, whose intercept is compatible with such value. Based on a visual assessment, large departures from this value (as suggested by the provided answer) for higher $N$ seem unlikely:
 
Similar considerations can be made for $K_2(0.5,1)$, which seems to converge to $\approx -0.17$:

 [/INST] Sigh, I hate fourier analysis. It turns people (especially me) into mindless, computing zombies.
The way to obtain $K_1(a,b)$ is literally just to interchange sums. I don't know why I didn't see this days ago. I don't have a fully rigorous proof, but I think it's just as rigorous as the fourier argument given in the other answer. This answer shows that $K_k(a,b) = \frac{-1}{2k}\log(\frac{b}{a})-\frac{k}{24}(b^2-a^2)$.
The intuitive reason the $\log$ appears is that $\frac{1}{2}$ is not the average value of $\{\frac{x}{m}\}$ for fixed $m$ as $x$ ranges. Instead, the average is $\frac{1}{m}\left[0+\frac{1}{m}+\dots+\frac{m-1}{m}\right] = \frac{m-1}{2m} = \frac{1}{2}-\frac{1}{2m}$. This "$\frac{-1}{2m}$" is the reason for the log. The reason for the $-\frac{k}{24}(b^2-a^2)$ is a bit harder to directly understand.
We assume $\frac{1}{a^2},\frac{1}{b^2}$ are integers that have the same residue modulo $k$. The result for any $a,b$ such that $\frac{1}{a^2}$ and $\frac{1}{b^2}$ are integers follows from an easy extension (to $k > 2$) of the reasoning given in the other answer.
$$\frac{1}{N}\sum_{x=1}^N \sum_{m=a\sqrt{x}}^{b\sqrt{x}} \left(\{\frac{x}{km}\}-\frac{1}{2}\right) = \frac{1}{N}\sum_{m=1}^{a\sqrt{N}}\sum_{x=m^2/b^2}^{m^2/a^2}\left(\{\frac{x}{km}\}-\frac{1}{2}\right)+\frac{1}{N}\sum_{m=a\sqrt{N}}^{b\sqrt{N}}\sum_{x=m^2/b^2}^N \left(\{\frac{x}{km}\}-\frac{1}{2}\right)$$ Since we repeatedly cycle through the residues mod $km$, the first term is $$\frac{1}{N}\sum_{m=1}^{a\sqrt{N}} \frac{-1}{2}\left(\frac{\frac{m^2}{a^2}-\frac{m^2}{b^2}}{km}+O(1)\right) = \frac{-1}{4k}\left(1-\frac{a^2}{b^2}\right)+O\left(\frac{1}{\sqrt{N}}\right)$$ For each $m$, writing $N = q_m km+r_m$ for $0 \le r_m \le km-1$, the second term is $$\frac{1}{N}\sum_{m=a\sqrt{N}}^{b\sqrt{N}}\sum_{x=m^2/b^2}^{q_m km} \left(\{\frac{x}{km}\}-\frac{1}{2}\right) + \frac{1}{N}\sum_{m=a\sqrt{N}}^{b\sqrt{N}} \sum_{x=q_m km+1}^{q_m km+r_m} \left(\{\frac{x}{km}\}-\frac{1}{2}\right)$$ $$ = \frac{1}{N}\sum_{m=a\sqrt{N}}^{b\sqrt{N}} \frac{-1}{2}\left(q_m-\frac{m}{b^2k}+O(1)\right) + \frac{1}{N}\sum_{a=\sqrt{N}}^{b\sqrt{N}} \left[\left(\frac{1}{km}-\frac{1}{2}\right)+\dots+\left(\frac{r_m}{km}-\frac{1}{2}\right)\right]$$ $$ = \frac{-1}{2k}\log(b/a)+\frac{1}{4k}(1-\frac{a^2}{b^2})+\frac{1}{N}\sum_{m=a\sqrt{N}}^{b\sqrt{N}} \left(\frac{r_m(r_m+1)}{2km}-\frac{r_m}{2}\right)$$ The sum can be written as $$\frac{1}{N}\sum_{m=a\sqrt{N}}^{b\sqrt{N}} \frac{mk}{2}(\frac{r_m}{km})^2-\frac{mk}{2}(\frac{r_m}{mk}),$$ and since $\frac{r_m}{mk} = \{\frac{N}{mk}\}$ should be equidistributed, and since $\int_0^1 x^2-x dx = \frac{-1}{6}$, we heuristically get $$\frac{1}{N}\sum_{m=a\sqrt{N}}^{b\sqrt{N}} \frac{mk}{2}(-\frac{1}{6}) = \frac{-k}{24}(b^2-a^2).$$ Putting everything together gives the desired $$\lim_{N \to \infty} \frac{1}{N}\sum_{x=1}^N \sum_{m=a\sqrt{x}}^{b\sqrt{x}} \left(\{\frac{x}{km}\}-\frac{1}{2}\right) = \frac{-1}{2k}\log\left(\frac{b}{a}\right)-\frac{k}{24}\left(b^2-a^2\right).$$
</s>