Truly,
my genuine problem (see Appendix for context) is compute in a closed form or an asymptotic, for real $x\geq 1$, for $$\int_1^x\left(\int_0^{y-1}\cos\left(\frac{2\pi t x}{y}\right)dt\right)dy.$$
My computations are humbles and this time I prefer see your method, but I know the calculus of integrals and series expansion theory. By elementary integration I can write previous integral as $$\frac{1}{2\pi x}\int_1^x y\sin\left(\frac{2\pi (y-1) x}{y}\right)dy.$$
Thus,
Question. Can you find a closed form or an asymptotic expansion for any of previous integrals? Thanks in advance.
Appendix: Let an integer $k\geq 1$, then it's known (see for exampe page 158 in [1]) that $\delta_k(n)=\sum_{m=0}^{k-1}e^{(2\pi i m n)/k}$ is equal to $k$ when $k\mid n$, and this finite sum is equal to $0$ if $k\nmid n$. Thus since $\Re\delta_k(n)=\delta_k(n)$ and $\sum_{1\leq k\leq n}\delta_k(n)=\sum_{k\mid n}\delta_k(n)$, we have directly the following
Fact. For an integer $n\geq 1$ $$\sigma(n)=\sum_{k=1}^n\sum_{m=0}^{k-1}\cos\left(\frac{2\pi m n}{k}\right),$$ where $\sigma(n)=\sum_{d\mid n}d$ is the sum of divisor function.
Then I make the game to change/modify (I hope that there aren't mistakes in this analogy) from $\sigma(n)$ to the previous integral that I've cited as my genuine problem, searching if such digressions (for example I've changed $\sum_{d\mid n}$ by $\int_1^x$) produce good questions. My goal in learn and refresh my mathematics, but truly my thoughts in this problem was ask to me how many far are my ideas and computations, in the specualtive way, to evaluate $limsup_{n\to\infty}\frac{\hat{\sigma}(n)}{n\log\log n}$. Here $\hat{\sigma}(n)$ is the integral of my genuine problem evaluated in integers $x=n\geq 1$. Perhaps this speculative method doesn't produce well results, but I want put in game. If you (optionally) want to say something about this last exercise, this is the computation of this superior limit, you can leave a comment. Thanks in advance.
References:
[1] Tom M. Apostol, Analytic Number Theory, in the chapter about periodic arithmetical functions.
You are interested in the integral
$$ f(x) = \int_1^x y\sin\!\left(\frac{2\pi (y-1) x}{y}\right) dy, $$
and this is very close to the integral
$$ g(x) = \int_0^x y\sin\!\left(\frac{2\pi (y-1) x}{y}\right) dy, $$
which is (basically) expressible in closed form. To see this, first make the substitution $y = ux$ to get
$$ g(x) = x^2 \int_0^1 u \sin\Bigl(2\pi (x-1/u)\Bigr)\,du, $$
then use the formula $\sin(p-q) = \sin p \cos q - \cos p \sin q$ to get
$$ g(x) = x^2 \left[ \sin(2\pi x) \int_0^1 u \cos(2\pi/u)\,du - \cos(2\pi x) \int_0^1 u \sin(2\pi/u)\,du \right]. \tag{1} $$
According to Mathematica the coefficients $\int_0^1 u \cos(2\pi/u)\,du$ and $\int_0^1 u \cos(2\pi/u)\,du$ can be expressed in terms of the sine and cosine integrals.
Now that we have an expression for $g(x)$, and since
$$ f(x) = g(x) - \int_0^1 y\sin\!\left(\frac{2\pi (y-1) x}{y}\right) dy, \tag{2} $$
to get an asymptotic for $f(x)$ we just need to calculate an asymptotic of this last remaining integral. But this isn't too hard---first we set $(y-1)/y = -u$ then repeatedly integrate by parts:
$$ \begin{align} \int_0^1 y\sin\!\left(\frac{2\pi (y-1) x}{y}\right) dy &= \int_0^\infty \frac{-\sin(2\pi u x)}{(1+u)^3}\,du \\ &= \left[\frac{\cos(2\pi u x)}{2\pi x (1+u)^3}\right]_0^\infty + \frac{3}{2\pi x} \int_0^\infty \frac{\cos(2\pi u x)}{(1+u)^4}\,du \\ &= -\frac{1}{2\pi x} + \left[ \frac{3\sin(2\pi u x)}{(2\pi x)^2(1+u)^4}\right]_0^\infty + \frac{3\cdot 4}{(2\pi x)^2} \int_0^1 \frac{\sin(2\pi u x)}{(1+u)^5}\,du \\ &= -\frac{1}{2\pi x} + \left[\frac{-(3\cdot 4) \cos(2\pi u x)}{(2\pi x)^3 (1+u)^5}\right]_0^\infty \\ &\qquad\qquad\qquad\qquad+ \frac{3\cdot 4\cdot 5}{(2\pi x)^3} \int_0^\infty \frac{-\cos(2\pi u x)}{(1+u)^6}\,du \\ &= -\frac{1}{2\pi x} + \frac{3\cdot 4}{(2\pi x)^3} + \frac{3\cdot 4\cdot 5}{(2\pi x)^3} \int_0^\infty \frac{-\cos(2\pi u x)}{(1+u)^6}\,du \\ &= \cdots. \end{align} $$
And, as the remainder is always bounded by the size of the most recently generated term, this produces an asymptotic series for the integral in question. This series has the form
$$ \int_0^1 y\sin\!\left(\frac{2\pi (y-1) x}{y}\right) dy \sim -\frac{2!}{2(2\pi x)} + \frac{4!}{2(2\pi x)^3} - \frac{6!}{2(2\pi x)^5} + \frac{8!}{2(2\pi x)^7} - \cdots $$
and so, combining this with $(1)$ and $(2)$, we conclude that $f(x)$ has the asymptotic expansion
$$ \begin{align} f(x) &\sim x^2 \left[ \sin(2\pi x) \int_0^1 u \cos(2\pi/u)\,du - \cos(2\pi x) \int_0^1 u \sin(2\pi/u)\,du \right] \\ &\qquad\quad - \frac{1}{2} \sum_{n=1}^{\infty} \frac{(-1)^n (2n)!}{(2\pi x)^{2n-1}} \end{align} $$
as $x \to \infty$.