Consider the functions $f_m : [0,1] \to \mathbb{R}$ defined by
$f_m(x) = \displaystyle\sum_{n=1}^{m} \frac{\sin(nx)}{1+\sin^2(n)}$
for every natural number $m$. My task is to find the number of roots of this function for every $m$. After some thought, I think it behaves similarly to the function $g_m(x) = \sum_{n=1}^{m}\sin(nx) = \frac{\sin{(m+1)x/2}}{\sin{(x/2)}}\sin{(mx/2)}$ which has roots $x= 2k\pi/m$, $0 \le k \le m/2\pi$ and $x = 2l\pi/(m+1), 0 \le l \le (m+1)/2k\pi$. This gives $\left\lfloor \frac{m}{2\pi}\right\rfloor+\left\lfloor \frac{m+1}{2\pi}\right \rfloor+1$ roots in the interval $[0,1]$ for the function $g_m$.
This did match the number of roots of $f_m$ for some values of $m$, however, inconsistencies were noticed for values of $m$ near $31$. Roots of $g_m$ tell us that the number of roots must keep increasing as $m$ increases, which doesn't seem to be true for $f_m$. The number of roots decreased from $9$ to $8$ from $m=30$ to $31$, and $11$ to $9$ from $m=32$ to $33$. Any hints on how to proceed with this problem? We perhaps require an appropriate correction term with $g_m$.