By De Moivre's theorem followed by the binomial theorem:
$$ \begin{aligned} & ~~\cos(nx)+i\sin(nx) = \cos^n(x)\left(1+i\tan(x)\right)^n \\& \implies \cos(nx) = \Re(\mathcal{RHS}) =\cos^n(x)\sum_{k ~\text{even}}\binom{n}{k}(-1)^{k/2}\tan^{k}(x) \\& \implies \displaystyle \sin(nx) = \Im(\mathcal{RHS}) =\cos^n(x)\sum_{k ~\text{odd}}\binom{n}{k}(-1)^{\frac{1}{2}k(k+1)+1}\tan^{k}(x) \\& \implies \tan(nx) = \frac{\sum_{k ~\text{odd}}\binom{n}{k}(-1)^{\frac{1}{2}k(k+1)+1}\tan^{k}(x)}{\sum_{k ~\text{even}}\binom{n}{k}(-1)^{k/2}\tan^{k}(x)} \end{aligned}$$The $\frac{1}{2}k(k+1)+1$ is not deep - it's just there to ensure alternating signs.
The $\mathcal{LHS}$ gives $\tan(nx) = 0 \implies x = \frac{j\pi}{n} $ for $1 \le j \le n-1$ & from $\mathcal{RHS}$
$$\sum_{k ~\text{odd}}\binom{n}{k}(-1)^{\frac{1}{2}k(k+1)+1}\tan^{k}(x) =0$$
Multiplying out by $\cot^n(x)$ we get
$$\sum_{k ~\text{odd}}\binom{n}{k}(-1)^{\frac{1}{2}k(k+1)+1}\cot^{k}(x) =0$$
So $\cot(x) = t$ where $\displaystyle x = \frac{j\pi}{n}, ~~ 1 \le j \le n-1$ satisfies
$$\sum_{k ~\text{odd}}\binom{n}{k}(-1)^{\frac{1}{2}k(k+1)+1} t^{k} =0$$
By Vieta's formulas, the sum of the squares of the roots is
$$\begin{aligned} \sum_{j=1}^{n-1}\cot^2\left(\frac{j\pi}{n}\right) &= \bigg(\sum_{j=1}^{n-1}\cot\left(\frac{j\pi}{n}\right)\bigg)^2-2\bigg(\sum_{j > j' \ge 1}^{n-1}\cot\left(\frac{j\pi}{n}\right)\cot\left(\frac{j'\pi}{n}\right)\bigg) \\& = 2\binom{n}{3}\bigg/\binom{n}{1} = \frac{1}{3} (n-2) (n-1).\end{aligned}$$
Since $\cot^2{x}+1 = \csc^2{x}$ our desired conclusion is reached:
$$\begin{aligned} \sum_{j=1}^{n-1}\csc^2\left(\frac{j\pi}{n}\right) & = \sum_{j=1}^{n-1}\bigg(1+\cot^2\left(\frac{j\pi}{n}\right)\bigg) \\& = n-1+\sum_{j=1}^{n-1}\cot^2\left(\frac{j\pi}{n}\right) \\& = n-1+\frac{1}{3} (n-2) (n-1) \\& = \frac{1}{3}(n^2-1). \end{aligned} $$