Evaluation of $$\int\frac{1}{(\sin x+a\sec x)^2}dx$$
Try: Let $$I=\int\frac{1}{(\sin x+a\sec x)^2}dx=\int\frac{\sec^2 x}{(\tan x+a\sec^2 x)^2}dx$$
put $\tan x=t$ and $dx=\sec^2 tdt$
So $$I=\int\frac{1}{(a+at^2+t)^2}dt$$
Could some help me how to solve above Integral , thanks in advance.
HINT
Let $$b=\dfrac1{2a},\quad y=t+b,\tag1$$ then $$I=4b^2\int\dfrac{dt}{(t^2+2bt+1)^2} = 4b^2\int\dfrac{dy}{(y^2+1-b^2)^2} = \dfrac{4b^2}{1-b^2}\int\dfrac{(y^2+1-b^2)-y^2}{(y^2+1-b^2)^2}\,dy,$$ $$I=\dfrac{4b^2}{1-b^2}(I_1+I_2),\tag2$$ where $$I_1=\int\dfrac{dy}{y^2+1-b^2} = const + \begin{cases}\dfrac1{\sqrt{1-b^2}}\arctan\dfrac{y}{\sqrt{1-b^2}},\text{ if } b<1\\[4pt] -\dfrac1y,\text{ if }b=1\\[4pt] \dfrac1{2\sqrt{b^2-1}}\ln\left|\dfrac{y-\sqrt{b^2-1}}{y+\sqrt{b^2-1}}\right|, \text{ if }b>1, \end{cases}\tag3$$ $$I_2 = -\int\dfrac{y^2dy}{(y^2+1-b^2)^2} = \dfrac12\int y\cdot d\left(\dfrac{1}{y^2+1-b^2}\right) = \dfrac12\dfrac{y}{y^2+1-b^2} - \dfrac {I_1}2.\tag4$$