If:
$$f(x)=\begin{cases} 0, & \text{if } -\pi < x < 0 \\ \sin(x), & \text{if } 0 \le x < \pi \end{cases}$$
then we find the coefficients as follows
\begin{aligned}
a_n&=\frac{1}{\pi}\int_{-\pi}^{\pi}\left(\begin{cases} 0, & \text{if } -\pi < x < 0 \\ \sin(x), & \text{if } 0 \le x < \pi \end{cases}\right)\cos(nx){dx},\\
&=\frac{1}{\pi}\int_{0}^{\pi}\sin(x)\cos(nx){dx},\\
&=-{\frac {\cos \left( \pi \,n \right) +1}{\pi \, \left( {n}^{2}-1
\right) }}=-{\frac {(-1)^n +1}{\pi \, \left( {n}^{2}-1
\right) }},\\
=&\begin{cases} 0,& \text{if } n \text{ is odd} \\ {-\frac {2}{\pi \, \left( n^2-1\right) }}, & \text{if } n \text{ is even} \end{cases}
\end{aligned}
if $n=1$ in the second from last line we would take the limit and see that it is zero; alternatively we could plug $n=1$ in the integral and see that that is zero, but either way we don't need any odd $n$ they are all zero.
Now we check the $b_n$:
\begin{aligned}
b_n&=\frac{1}{\pi}\int_{-\pi}^{\pi}\left(\begin{cases} 0, & \text{if } -\pi < x < 0 \\ \sin(x), & \text{if } 0 \le x < \pi \end{cases}\right)\sin(nx){dx},\\
&=\frac{1}{\pi}\int_{0}^{\pi}\sin(x)\sin(nx){dx},\\
&=-{\frac {\sin \left( \pi \,n \right) }{\pi \, \left( {n}^{2}-1
\right) }},\\
=&\begin{cases} 0,& \text{if } n\ne 1 \\ -1/2 & \text{if } n=1 \end{cases}
\end{aligned}
so we have to be careful there, we either take the limit when $n\rightarrow1$ or put $n=1$ in the integral but we do need one of the $sin$ terms. We then have:
\begin{aligned}
f(x)&=\frac{a_0}{2}+\sum_{n=1}^{\infty}a_n \cos(nx)+b_n\sin(nx),\\
&=\frac{1}{\pi}+\frac{\sin(x)}{2}-\sum_{n=1}^{\infty}{\frac {2}{\pi \, \left( 4n^2-1\right) }} \cos(2nx).
\end{aligned}
