I am trying to solve the following integral containing fractional part function (denoted by $\{.\}$)
$$\int_0^1 x^n\left\{\frac{k}{x}\right\}dx,\ 0<k\le 1,\ n\in \mathrm N^*$$
For $n=0$, it is already known that $\int_0^1 \left\{\frac{k}{x}\right\}dx=k(1-\gamma-\ln k)$.
I followed the same technique to solve for general $n$. I am stuck at the end to find the closed form of those sums if possible. Please see the picture.

I will try to redo the work from beggining and try to color in red what it's not right, let me know if I am missing something too please.$${I(n,k)=\int_0^1 x^{n}\left\{\frac{k}{x}\right\}dx }\overset{\large x=\frac{k}{t}}=k^{n+1}\int_k^\infty \frac{\left\{t\right\}}{t^{n+2}}dt=$$ $$=k^{n+1} \int_k^1 \frac{t-\lfloor t \rfloor}{t^{n+2}}dt+k^{n+1}\int_1^\infty \frac{t-\lfloor t \rfloor}{t^{n+2}}dt$$ $$=k^{n+1} \int_k^1 \frac{dt}{t^{n+1}}dt+k^{n+1}\sum_{i=1}^\infty \int_i^{i+1}\frac{\color{red}{t-i}}{t^{n+\color{red}2}}dt$$ $$=k^{n+1} \left(-\frac1n \cdot \frac{1}{t^n}\right)\bigg|_k^1+k^{n+1}\sum_{i=1}^\infty \underbrace{\int_0^1 \frac{y+\overbrace{i-i}^{=0}}{(y+i)^{n+2}}dy}_{\large t-i=y}$$ $$=\frac{k^{n+1}}{\color{red}n}\left(\frac{1}{k^n}-1\right)+k^{n+1}\sum_{i=1}^\infty \int_0^1 \left(\frac{1}{(y+i)^{n+1}}-\frac{i}{(y+i)^{n+2}}\right)dy$$ $$=\frac{k^{n+1}}{n}\left(\frac{1}{k^n}-1\right)+k^{n+1}\sum_{i=1}^\infty \left(-\frac{1}{n}\frac{1}{(y+i)^{n}}+\frac{i}{n+1}\frac{1}{(y+i)^{n+1}}\right)\bigg|_0^1$$ $$=\frac{k^{n+1}}{n}\left(\frac{1}{k^n}-1\right)+k^{n+1}\sum_{i=1}^\infty \left(\frac1n \left(\frac{1}{i^n}-\frac{1}{(i+1)^n}\right)+\frac{i}{n+1}\left(\frac{1}{(i+1)^{n+1}}-\frac{1}{i^{n+1}}\right)\right)$$ You arrived until here too. Now let's take that sum separately. $$S=\frac1n\underbrace{\sum_{i=1}^\infty \left(\frac{1}{i^n}-\frac{1}{(i+1)^n}\right)}_{S_1}-\frac{1}{n+1}\sum_{i=1}^\infty\underbrace{\left(\frac{i}{i^{n+1}}-\frac{i}{(i+1)^{n+1}}\right)}_{S_2}$$ For $S_1$ notice that plugging in some terms yiels a nice telescoping series: $$\require{cancel} i=1: \frac{1}{1^n}-\cancel{\frac1{2^n}}$$ $$i=2: \cancel{\frac{1}{2^n}}-\cancel{\frac1{3^n}}$$ $$i=3: \cancel{\frac{1}{3^n}}-\cancel{\frac1{4^n}}$$ $$i=4: \cancel{\frac{1}{4^n}}-\cancel{\frac1{5^n}}$$ $$\dots$$ $$\Rightarrow S_1= \frac{1}{1^n}=1$$ And for $S_2$ we will try to obtain a similar relationship.
First plugging some terms to notice a pattern for $S_2$: $$i=1: \frac{1}{1^{n+1}}-\color{blue}{\frac{1}{2^{n+1}}}$$ $$i=2: \color{blue}{\frac{2}{2^{n+1}}}-\color{orange}{\frac{2}{3^{n+1}}}$$ $$i=3: \color{orange}{\frac{3}{3^{n+1}}}-\color{purple}{\frac{3}{4^{n+1}}}$$ $$i=4: \color{purple}{\frac{4}{4^{n+1}}}-\color{red}{\frac{4}{5^{n+1}}}$$ $$i=5: \color{red}{\frac{5}{5^{n+1}}}-\dots$$ Now guess what happens to the terms colored in the same color?
Yes, the numerator of each fraction are consecutive numbers and by reducing them we arrive at: $$S_2=\frac{1}{1^{n+1}}+\color{blue}{\frac{1}{2^{n+1}}}+\color{orange}{\frac{1}{3^{n+1}}}+\color{purple}{\frac{1}{4^{n+1}}}+\color{red}{\frac{1}{5^{n+1}}}+\dots =\zeta(n+1)$$ $$\Rightarrow {I(n,k)=\frac{k^{n+1}}{n}\left(\frac{1}{k^n}-\cancel{1}\right)+k^{n+1}\left(\cancel{\frac1{n}}-\frac{\zeta(n+1)}{n+1}\right)}$$ $$=\boxed{I(n,k)=\frac{k}{n}-k^{n+1}\frac{\zeta(n+1)}{n+1}}$$