$$\lim_{x\to 0} \left(\sum_{r=1}^{n}r^{\frac{1}{\sin^2x}}\right)^{\sin^2x}$$
$$\begin{aligned}\lim_{x\to 0}\left(\sum_{r=1}^{n}r^{\frac{1}{\sin^2x}}\right)^{\sin^2x}&=n\lim_{x\to 0}\left(\sum_{r=1}^{n}\left(\frac{r}{n}\right)^{\frac{1}{x^2}}\right)^{x^2}\\ &=n\lim_{x\to 0}\left(\int_{0}^{1}y^{1/x^2}\mathrm dy\right)^{x^2}\\&=n\lim_{x\to 0}\left(\frac{x^2}{x^2+1}\right)^{x^2} =n \end{aligned}$$
I did get the right answer. But I am wondering whether writing the Riemann sum as a definite integral without the $\lim$ on $n$ is valid. Please clarify. Thanks.
Leaving only last from summands for left side and for right side replace all summunds with last we have: $$n\leqslant \left(\sum\limits_{r=1}^{n}r^{\frac{1}{\sin^2x}}\right)^{\sin^2x}\leqslant \left( n\cdot n ^ {\frac{1}{\sin^2x}} \right)^{\sin^2x}\to n, \text{ when }x\to 0$$