Integral $ \int \frac{dx}{\cos^3 x+2\sin(2x)-5\cos x}$
We want to find $$\int \frac{\cos x}{(\cos^2 x+4\sin x-5)(\cos^2 x)}\,dx,$$ or equivalently $$\int \frac{\cos x}{(-\sin^2 x+4\sin x-4)(1-\sin^2 x)}\,dx.$$ The substitution $u=\sin x$ turns this into $$\int\frac{-1}{(2-u)^2 (1-u^2)}\,du,$$ which yields (after a while) to partial fractions.
The present integrand is a rational function (i.e. a ratio of two polynomials) of $\cos x$ and $\sin x$, which is considered a common question. So I take it partially from the answer by Arturo Magidin to the question Evaluating $\int P(\sin x, \cos x) \text{d}x$ by Aryabhata, which is an entry of the List of Generalizations of Common Questions.
Weierstrass Substitution
A method that always works is Weierstrass substitution, which will turn such an integral into an integral of rational functions, which in turn can always be solved, at least in principle, by the method of partial fractions. This works even for rational functions of sine and cosine, as well as functions that involve the other trigonometric functions.
Weierstrass substitution replaces sines and cosines (and by extension, tangents, cotangents, secants, and cosecants) by rational functions of a new variable. The identities begin by the trigonometric substitution $t = \tan\frac{x}{2}$, with $-\pi\lt x\lt \pi$, which yields $$\begin{align*} \sin x &= \frac{2t}{1+t^2}\\ \cos x &= \frac{1-t^2}{1+t^2}\\ dx &= \frac{2\,dt}{1+t^2}. \end{align*}$$
Now we have
$$I =\int \frac{dx}{\cos ^{3}x+4\sin x\cos x-5\cos x}.$$
Using the substitution above we obtain:
\begin{eqnarray*} I &=&\int \frac{2}{\left( \frac{1-t^{2}}{1+t^{2}}\right) \left( \left( \frac{ 1-t^{2}}{1+t^{2}}\right) ^{2}+4\frac{2t}{1+t^{2}}-5\right) \left( 1+t^{2}\right) }\,dt \\[2ex] &=&\frac{1}{2}\int \frac{\left( 1+t^{2}\right) ^{2}}{\left( -1+t^{2}\right) \left( t^{2}-t+1\right) ^{2}}dt, \end{eqnarray*}
which can be integrated by the method of partial fractions:
\begin{eqnarray*} I&=&\frac{1}{2}\int \left( \frac{2}{-1+t}-\frac{2}{9\left( 1+t\right) }-\frac{ 1}{9}\frac{-5+16t}{t^{2}-t+1}-\frac{1}{3}\frac{-2+t}{\left( t^{2}-t+1\right) ^{2}}\right) dt \\[2ex] &=&\ln (\left\vert -1+t\right\vert -\frac{1}{9}\ln \left( \left\vert 9+9t\right\vert \right) -\frac{4}{9}\ln \left( \left\vert t^{2}-t+1\right\vert \right) +\frac{1}{6}\frac{t}{t^{2}-t+1}+C \\[2ex] &=&\ln \left( \left\vert -1+\tan \frac{x}{2}\right\vert \right) -\frac{1}{9} \ln \left( \left\vert 9+9\tan \frac{x}{2}\right\vert \right) -\frac{4}{9}\ln \left( \left\vert \tan ^{2}\frac{x}{2}-\tan \frac{x}{2}+1\right\vert \right) +\frac{1}{6}\frac{\tan \frac{x}{2}}{\tan ^{2}\frac{x}{2}-\tan \frac{x}{2}+1} +C. \end{eqnarray*}
PS. I've checked that the derivative of this last integral is
$$ \frac{1}{4}\frac{3\tan ^{2}\frac{x}{2}+\tan ^{6}\frac{x}{2}+3\tan ^{4}\frac{x}{2}+1}{\left( -1+\tan \frac{x}{2}\right) \left( 1+\tan \frac{x}{2}\right) \left( \tan ^{2}\frac{ x}{2}-\tan \frac{x}{2}+1\right) ^{2}}, $$
which is equal to
$$\frac{1}{\cos ^{3}x+4\sin x\cos x-5\cos x}.$$