Integrate $\int_0^{\pi/2}\frac{\tan x}{1+m^2\tan^2 x}dx$ 
Integrate $\int_0^{\pi/2}\frac{\tan x}{1+m^2\tan^2 x}dx$

$\newcommand{\intd}[1]{\,\mathrm{d}#1}$
My Attempt
Put $t=\tan x\implies\intd t=\sec^2x\intd x$
\begin{align*}
\int_0^{\pi/2}\frac{\tan x}{1+m^2\tan^2 x}dx&=\int_0^{\pi/2}\frac{\tan x\cdot\sec^2x}{(1+m^2\tan^2 x)\sec^2x}\intd x\\
&=\int_0^{\infty}\frac{t}{(1+m^2t^2)(1+t^2)}\intd t
\end{align*}
Put $t^2=y\implies 2t\intd t=\intd y$
\begin{align*}
\frac{1}{2}\int_0^\infty\frac{dy}{(1+m^2y)(1+y)}&=\frac{1}{2}\int_0^\infty\bigg[\frac{1}{1-m^2}\cdot\frac{1}{1+y}+\frac{m^2}{m^2-1}\cdot\frac{1}{1+m^2y}\bigg]dy\\
&=\frac{1}{2(1-m^2)}\int_0^\infty\frac{dy}{1+y}-\frac{m^2}{2(1-m^2)}\int_0^\infty\frac{dy}{1+m^2y}\\
&=\bigg[\frac{1}{2(1-m^2)}\log|1+y|-\frac{1}{2(1-m^2)}\log|1+m^2y|\bigg]_0^\infty\\
&=\bigg[\frac{1}{2(1-m^2)}\log|\frac{1+y}{1+m^2y}|\bigg]_0^\infty=\color{red}{\frac{1}{2(1-m^2)}\bigg[\frac{\infty}{\infty}-0\bigg]}\end{align*}
I think I am getting stuck here as the substitutions does not seem to give the solution ?
Doubt
$$
\lim_{y\to 0}\log|\frac{1+y}{1+m^2y}|=\log 1=0\\
\lim_{y\to \infty}\log|\frac{1+y}{1+m^2y}|=\lim_{y\to \infty}\log|\frac{\frac{1}{y}+1}{\frac{1}{y}+m^2}|=\log\frac{1}{m^2}
$$
So what really we are doing with definite integrals ?. Does this mean that we are actually computing the upper and lower limits and taking the difference to find the definite integral ?
Note: Expanding in terms of $\sin x$ and $\cos x$ gives the solution, no doubt about limit going to infinity, not looking for that.
 A: You have one error $$\frac{m^2}{1-m^2}\int\frac{1}{1+m^2y}\,\mathrm{d}y=\frac{1}{1-m^2}\log|1+m^2y|+C$$
So your final answer is 
\begin{align*}
\bigg[\frac{1}{2(1-m^2)}\log|1+y|-\frac{1}{2(1-m^2)}\log|1+m^2y|\bigg]_0^\infty&=\frac{1}{2(1-m^2)}\left[\log|1+y|-\log|1+m^2y|\right]_0^\infty\\
&=\frac{1}{2(1-m^2)}\log\left|\frac{1+y}{1+m^2y}\right|\bigg\rvert_0^\infty\\
&=\frac{1}{2(1-m^2)}\log\left(\frac1{m^2}\right)\\
&=\boxed{\frac{\log m}{m^2-1}}
\end{align*}
A: I think that you could have done it faster avoiding the second change of variable since, as you wrote, 
$$
I=\int\frac{\tan (x)}{1+m^2\tan^2 (x)}\,dx=\int\frac{t}{(1+m^2t^2)(1+t^2)}\,dt
$$ Now, partial fraction decomposition gives 
$$\frac{t}{(1+m^2t^2)(1+t^2)}=\frac{m^2 t}{\left(m^2-1\right) \left(1+m^2 t^2\right)}-\frac{t}{\left(m^2-1\right)
   \left(1+t^2\right)}$$ making 
$$I=\int\frac{t}{(1+m^2t^2)(1+t^2)}\,dt=\frac{\log \left(1+m^2 t^2\right)-\log \left(1+t^2\right)}{2(m^2-1)}$$ $$I=\frac 1{2(m^2-1)}\log\left(\frac{1+m^2t^2}{1+t^2}\right)$$
