Solution verification of $\lim_{n\to\infty}\left(1+\left(\sum_{k=1}^{n-1}\frac{k}{n}\sin\left(\frac{k\pi}{n}\right)\right)^{-1}\right)^{n}$ $$\lim_{n\to\infty}\left(1+\left(\sum_{k=1}^{n-1}\frac{k}{n}\sin\left(\frac{k\pi}{n}\right)\right)^{-1}\right)^{n}$$
Source: Romanian Mathematical Magazine Spring edition 2022, problem UP. 354.
I work out in following manner.
Clearly, $\displaystyle \frac{k\pi}{n}>0$  for all $k\in[ 1, n-1]$ so due to    Taylor series around $x=0$ we have $\sin x \leq x$ for all $ x>0$. Choose $\displaystyle x=\frac{k\pi}{n}$  we have then $$\sin\left(\frac{k\pi }{n}\right)\leq \frac{k\pi}{n}\Rightarrow S(n)= \sum_{k=1}^{n-1}\frac{k}{n}\sin\left(\frac{k\pi}{n}\right)\leq \pi\sum_{k=1}^{n-1}\frac{k^2}{n^2}=\frac{\pi}{6}\left[\frac{(n-1)(2n-1)}{n}\right]\cdots(1)$$ Since  the partial sum of the later sum diverges as $n\to \infty$ so $S(n)\to \infty$ (due to comparison test). Therefore,$$L=\lim_{n\to \infty} \left(1+\left(S(n)\right)^{-1}\right)^{n}=1^{\infty}$$ and hence we have $$L= \lim_{n\to\infty}\exp\left(\left(S(n)\right)^{-1}\right)=\exp\left(\lim_{n\to \infty}n\left(\sum_{k=1}^{n-1}\frac{k}{n}\sin\left(\frac{k\pi}{n}\right)\right)^{-1}\right)$$ since latter expression is Riemann integrable function on $[0,1]$ so the limit reduces to $$L= \exp\left(\int_0^1 x\sin(\pi x) dx\right)^{-1} \underbrace {=}_{IBP}e^{\left(\pi^{-1}\right)^{-1}}=e^{\pi}$$
The reason of $(1)$ in above is to show that for large value  of $n$ the original sum is divergent so that its reciprocal is $0$ giving us $1^{\infty}$ form.
Question:
Is my work and inequality $(1)$ supports the valid proof?
I manage  to find the limit of problem  in other way by showing that $$\sum_{k=1}^{n-1}\frac{k}{n}\sin\left(\frac{k\pi}{n}\right)=\frac{1}{2}\cot\left(\frac{\pi}{2n}\right)$$ giving us $e^{\pi}$.
 A: From $S(n) \leq \pi\sum_{k=1}^{n-1}\frac{k^2}{n^2}$ we can't conclude for divergenge, we can proceed as follows
$$\frac{k}{n}\sin\left(\frac{k\pi}{n}\right) =\frac{k}{n}\left(\frac{k\pi}{n}-\frac{\pi^3}{3!}\frac{k^3}{n^3}+\frac{\pi^5}{5!}\frac{k^5}{n^5}+\ldots\right)=\sum_{i=1}^\infty (-1)^{i-1}\frac{\pi^{2i-1}}{(2i-1)!}\left(\frac{k}{n}\right)^{2i}$$
and
$$\sum_{k=1}^{n-1}\frac{k}{n}\sin\left(\frac{k\pi}{n}\right) =\sum_{i=1}^\infty\left( (-1)^{i-1}\frac{\pi^{2i-1}}{(2i-1)!}\sum_{k=1}^{n-1}\left(\frac{k}{n}\right)^{2i}\right)=$$
$$=\sum_{i=1}^\infty\left( (-1)^{i-1}\frac{\pi^{2i-1}}{(2i-1)!}\left(\frac {n}{2i+1}-\frac12+O\left(\frac1n\right)\right)\right)=$$
$$=n\sum_{i=1}^\infty\left( (-1)^{i-1}\frac{\pi^{2i-1}}{(2i+1)(2i-1)!}\right)+O\left(\frac1n\right)=\frac n \pi+O\left(\frac1n\right)$$
indeed
$$\sum_{i=1}^\infty\left( (-1)^{i-1}\frac{x^{2i-1}}{(2i+1)(2i-1)!}\right)=\frac{\sin x -x\cos x}{x^2}$$
then
$$\lim_{n\to\infty}\left(1+\left(\sum_{k=1}^{n-1}\frac{k}{n}\sin\left(\frac{k\pi}{n}\right)\right)^{-1}\right)^{n}=\lim_{n\to\infty}\left(1+\frac {1}{\frac n \pi+O\left(\frac1n\right)}\right)^{n} =e^\pi$$
A: As an alternative by
$$\sum_{k=1}^{n-1}\frac{k}{n}\sin\left(\frac{k\pi}{n}\right) =\Im\left(\frac1n \sum_{k=1}^{n-1} ke^{\frac{k\pi}{n}i}\right)$$
we can use that
$$\sum_{k=1}^{n-1} kx^k=\frac{(n-1)x^{n+1} - nx^n +x}{(x-1)^2}$$
and by $x=e^{\frac{\pi}{n}i}$ we obtain
$$\Im\left(\frac1n \sum_{k=1}^{n-1} ke^{\frac{k\pi}{n}i}\right)=\Im\left(\frac1{1-e^{\frac{\pi}{n}i}}\right)=\frac{\sin \left(\frac{\pi}{n}\right)}{2-2\cos \left(\frac{\pi}{n}\right)}=\frac{1}{2}\cot\left(\frac{\pi}{2n}\right)$$
and then
$$\lim_{n\to\infty}\left(1+\left(\sum_{k=1}^{n-1}\frac{k}{n}\sin\left(\frac{k\pi}{n}\right)\right)^{-1}\right)^{n}
=\lim_{n\to\infty}\left(1+\frac {1}{\frac{1}{2}\cot\left(\frac{\pi}{2n}\right)}\right)^{n} =e^\pi$$
