Method 1:
\int \frac{dx}{a\sinx +b\cos x}
=\frac{1}{\sqrt{a^2+b^2}}\int \frac{dx}{\frac{a}{\sqrt{a^2+b^2}}\sinx +\frac{b}{\sqrt{a^2+b^2}}\cos x}
=\frac{1}{\sqrt{a^2+b^2}}\int \frac{dx}{\frac{a}{cos\alpha\sinx +\sinalpha\cos x}
=\frac{1}{\sqrt{a^2+b^2}}\int \frac{dx}{\sin(x+\alpha)}
=\frac{1}{\sqrt{a^2+b^2}}\int \cosec (x+\alpha)\ dx
=\frac{1}{\sqrt{a^2+b^2}}\ln|\tan \frac{1}{2}(x+\alpha)|+C
=\frac{1}{\sqrt{a^2+b^2}}\ln|\tan (x/2+\alpha/2)|+C
Where, \tan \alpha=b/a
Method 2:
\int \frac{dx}{a\sinx +b\cos x}
=\int \frac{dx}{a(\frac{2\tan(x/2)}{1+\tan^2(x/2)}) +b(\frac{1-\tan^2(x/2)}{1+\tan^2(x/2)}) }
=\int \frac{(1+\tan^2(x/2))dx}{2a\tan(x/2)+b-b\tan^2(x/2) }
=\int \frac{sec^2(x/2)dx}{b(2a/b \tan(x/2)+1-\tan^2(x/2)) }
=1/b\int \frac{sec^2(x/2)dx}{1-(\tan^2(x/2)-2a/b \tan(x/2)+(a/b)^2)+(a/b)^2 }
=2/{b}\int \frac{1/2sec^2(x/2)dx}{\frac{a^2+b^2}{b^2}-(\tan(x/2)-a/b)^2 }
=2/b\int \frac{d(\tan(x/2)-a/b)}{(\frac{\sqrt{a^2+b^2}}{b})^2-(\tan(x/2)-a/b)^2 }
Using standard formula: \int \frac{dt}{k^2-t^2}=1/{2k}\ln|\frac{k+t}{k-t}|,
=2/b\frac{1}{2\frac{\sqrt{a^2+b^2}}{b}} \ln|\frac{\frac{\sqrt{a^2+b^2}}{b}+\tan(x/2)-a/b}{\frac{\sqrt{a^2+b^2}}{b}-\tan(x/2)+a/b}|+C
=\frac{1}{\sqrt{a^2+b^2}} \ln|\frac{\sqrt{a^2+b^2}+b\tan(x/2)-a}{\sqrt{a^2+b^2}-b\tan(x/2)+a}|+C