Definite Integral of an Infinite Sum It is given that $$ f(x) = \sum_{n=1}^\infty \frac{\sin(nx)}{4^n} $$
How would one go about calculating $$ \int_0^\pi f(x)\ dx $$ 
EDIT:
I was able to calculate the integral of the $ \sin(nx) $ part using $u$ substitution. However, I lack the required knowledge to combine an integral and an infinite sum as this is the first time  I am doing this kind of a question.
I am currently studying in 11th in India under the CBSE curriculum. This question appeared in one of my internal tests and I am trying to get an explanation for it. 
I'd like to mention that I only posess basic knowledge of integration and differentiation as taught in my coaching center and knowledge of 11th grade NCERT math.
 A: Since the series converges uniformly, we can integrate term-wise. The result is
\begin{align*}
\int_{0}^{\pi} f(x) \, dx
&= \sum_{n=1}^{\infty} \frac{1}{4^n} \int_{0}^{\pi} \sin(nx) \, dx \\
&= \sum_{n=1}^{\infty} \frac{1}{4^n} \left[ -\frac{\cos (nx)}{n} \right]_{0}^{\pi} \\
&= \sum_{n=1}^{\infty} \frac{1 - (-1)^n}{n \cdot4^n}.
\end{align*}
Now using the Taylor expansion $\log(1+x) = \sum_{n=1}^{\infty} \frac{(-1)^{n-1}}{n} x^n$, we can simplify the above series as
$$ = - \log\left(1 - \tfrac{1}{4}\right) + \log\left(1 + \tfrac{1}{4}\right)
 = \log \left( \tfrac{5}{3} \right). $$

Alternatively, assuming basic knowledge on complex analysis,
\begin{align*}
\int_{0}^{\pi} f(x) \, dx
&= \operatorname{Im} \left( \int_{0}^{\pi} \sum_{n=1}^{\infty} \left( \frac{e^{ix}}{4} \right)^n \, dx \right)
 = \operatorname{Im} \left( \int_{0}^{\pi} \frac{e^{ix}}{4 - e^{ix}} \, dx \right) \\
(z=e^{ix}) \quad &= \operatorname{Im} \left( \int_{1}^{-1} \frac{1}{i(4-z)} \, dz \right)
 = \operatorname{Im} \left[ i \log(4-z) \right]_{1}^{-1} \\
&= \log 5 - \log 3
 = \log (5/3).
\end{align*}
This provides a natural explanation as to why logarithm appears in the final answer.
A: An alternative approach:
$$ f(x)=\text{Im}\sum_{n\geq 1}\frac{e^{inx}}{4^n} = \text{Im}\left(\frac{e^{ix}}{4-e^{ix}}\right) = \text{Im}\left(\frac{e^{ix}(4-e^{-ix})}{17-8\cos x}\right)=\frac{4\sin x}{17-8\cos x}$$
implies:
$$ \int_{0}^{\pi}f(x)\,dx=\left[\tfrac{1}{2}\,\log(17-8\cos x)\right]_{0}^{\pi}=\log\sqrt{\frac{17+8}{17-8}}=\color{red}{\log\tfrac{5}{3}}. $$
