How can I solve $f(x) = \int \frac{\cos{x}(1+4\cos{2x})}{\sin{x}(1+4\cos^2{x})}dx$? $$f(x) = \int \frac{\cos{x}(1+4\cos{2x})}{\sin{x}(1+4\cos^2{x})}dx$$
I have been up on this problem for an hour, but without any clues. 
Can someone please help me solving this?

It is quite straight forward after rewriting the integrand:
$$\frac{\cos x (1+4\cos 2x )}{\sin x (1+4\cos^2 x)}= \frac{\cos x}{\sin x}\left(1 - \frac{4\sin^2 x}{1+4\cos^2 x}\right)$$
$$= \frac{\cos x}{\sin x} - \frac{2\sin 2x}{3+2\cos 2x}$$
Note, that $(3+2\cos 2x)' = -4\sin 2x$ and integrate:
$$\int \frac{\cos{x}(1+4\cos{2x})}{\sin{x}(1+4\cos^2{x})}dx =\log |\sin x| + \frac 12 \log(3+2\cos 2x) + C$$
