Evaluate $\int_0^\pi \left(\frac{\sin{2x}\sin{3x}\sin{5x}\sin{30x}}{\sin{x}\sin{6x}\sin{10x}\sin{15x}}\right)^2 dx$ (from MIT Integration Bee 2023) This is from the final round of MIT Integration Bee 2023.
$$\int_0^\pi \left(\frac{\sin{2x}\sin{3x}\sin{5x}\sin{30x}}{\sin{x}\sin{6x}\sin{10x}\sin{15x}}\right)^2 dx$$
The given answer is $7\pi$.

I found a way to do it using contour integrals (see answer below), but this is not a calculation I can finish within 4 minutes (the time limit in the competition). I am still looking for other elegant methods, possibly without using contour integrals.

Let $f(x)$ denote the egregious fraction of sines inside the square. Writing $w = e^{2ix}$, we have
\begin{align*}
f(x)
&:= \frac{(\sin 2x)(\sin 3x)(\sin 5x)(\sin 30x)}{(\sin x)(\sin 6x)(\sin 10x)(\sin 15x)} \\
&= w^{-4} \underbrace{ \frac{(w^2 - 1)(w^3 - 1)(w^5 - 1)(w^{30} - 1)}{(w - 1)(w^6 - 1)(w^{10} - 1)(w^{15} - 1)} }_{=:g(w)}.
\end{align*}
Writing the fraction part in the last line as $g(w)$, algebraic manipulation using the finite geometric series formula yields
\begin{align*}
g(w)
= \frac{(w + 1)(w^{15} + 1)}{(w^3 + 1)(w^5 + 1)}
= \frac{w^{10} - w^5 + 1}{w^2 - w + 1}
= w^8 + w^7 - w^5 - w^4 - w^3 + w + 1,
\end{align*}
where we utilized the long division in the last step.1) Now, we write
$$ g(w) = \sum_{k\geq 0} a_k w^k $$
for simplicity. Then by noting that $f(x)$ is real-valued,
\begin{align*}
\int_{0}^{\pi} f(x)^2 \, \mathrm{d}x
&= \int_{0}^{\pi} f(x)\overline{f(x)} \, \mathrm{d}x \\
&= \int_{0}^{\pi} \left( e^{-8ix} g(e^{2ix}) \right) \overline{\left( e^{-8ix} g(e^{2ix}) \right)} \, \mathrm{d}x \\
&= \sum_{j,k} a_j \overline{a_k} \int_{0}^{\pi} e^{2ix(j-k)} \, \mathrm{d}x \\
&= \pi \sum_{k \geq 0} |a_k|^2 \\
&= 7\pi.
\end{align*}

1) Alternatively, if OP is familiar with some abstract algebra, we can proceed as below:
\begin{align*}
g(w)
= \prod_{d \mid 30} (w^d - 1)^{\mu(30/d)}
= \Phi_{30}(w)
= w^8 + w^7 - w^5 - w^4 - w^3 + w + 1,
\end{align*}
where $\mu$ is the Möbius function and $\Phi_n$ is the cyclotomic polynomial.
