<s>[INST] What is the easiest way to integrate $y=\frac {x+4}{\sqrt{-x^2-2x+3}}$? What is the easiest way to integrate $y=\frac{x+4}{\sqrt{-x^2-2x+3}}$ ? I tried to integrate it by making numerator in form: $-2x-2$ and then pulling it under differential, but the result drastically differed from Mathematica output.
 [/INST] Since $-x^2-2x+3=-(x+3)(x-1)$, both roots $x_1=-3,x_2=1$ are real. As such it is known that e.g. the Euler substitution 
\begin{align}
\sqrt{-x^{2}-2x+3}&=t(x-x_2)=t(x-1)\\[2ex] &\Leftrightarrow  x=\frac{t^{2}-3}{t^{2}+1}=1-\frac{4
}{1+t^{2}},\quad dx=\frac{8t}{\left( 1+t^{2}\right) ^{2}}dt, \\[2ex]
& \Leftrightarrow\sqrt{-x^{2}-2x+3}=-\frac{4t}{1+t^{2}}
\end{align}
will turn the original integral into an integral of a rational function in $t$ which can be integrated by the method of partial fractions: 
\begin{eqnarray*}
I &=&\int \frac{x+4}{\sqrt{-x^{2}-2x+3}}dx = \int\frac {1-{\dfrac {4}{1+t^2}+4}}{-\dfrac {4t}{1+t^2}}\frac {8t}{(1+t^2)^2}\, dt\\[2ex]
&=&\int -2\frac{1+5t^{2}}{\left( 1+t^{2}\right) ^{2}}dt=\int \frac{8}{\left( 1+t^{2}\right) ^{2}}- \frac{10}{1+t^{2}}dt\\[2ex]
&=&\int \frac{8}{\left( 1+t^{2}\right) ^{2}}dt-\int \frac{10}{1+t^{2}}dt,\quad \text{(see note below)  }\\[2ex]
&=&\left(\frac{4t}{1+t^{2}}+4\arctan t\right)-10\arctan t+C \\[2ex]
&=&\frac{4t}{1+t^{2}}-6\arctan t +C\\[2ex]
&=&-\sqrt{-x^{2}-2x+3}-6\arctan \frac{\sqrt{-x^{2}-2x+3}}{x-1}+C.
\end{eqnarray*}
Note. 


*

*By the method explained here  we can reduce the integration of the function $f(t)=\frac{1}{\left( 1+t^{2}\right) ^{2}}$ to the integration of $\frac{1}{1+t^{2}}$.  We start by adding and subtracting $t^2$ in the numerator.  The first integral is a standard integral and  the second one is integrable by parts:
$$\begin{eqnarray*}
\int \frac{1}{\left( 1+t^{2}\right) ^{2}}dt &=&\int \frac{1}{1+t^{2}}dx-\int \frac{t^{2}}{\left( 1+t^{2}\right) ^{2}}dt
\\
&=&\arctan t-\int t\frac{t}{\left( 1+t^{2}\right) ^{2}}dt,
\end{eqnarray*}$$
and 
$$\begin{eqnarray*}
\int t\frac{t}{\left( 1+t^{2}\right) ^{2}}dt &=&t\left( -\frac{1}{2\left(
1+t^{2}\right) }\right) +\int \frac{1}{2\left( 1+t^{2}\right) }dt \\
&=&-\frac{t}{2\left( 1+t^{2}\right) }+\frac{1}{2}\arctan t.
\end{eqnarray*}$$
We thus get
$$\int \frac{1}{\left( 1+t^{2}\right) ^{2}}dt =\frac{t}{2\left( 1+t^{2}\right) }+\frac{1}{2}\arctan t,$$
$$\int \frac{8}{\left( 1+t^{2}\right) ^{2}}dt =\frac{4t}{1+t^{2}}+4\arctan t.$$


Comments. 


*

*The Euler substitutions are more general, but when the integrand is a rational function of $x$ and $\sqrt{a^2-x^2}$, $\sqrt{a^2+x^2}$, $\sqrt{x^2-a^2}$, with $a>0$, trigonometric  and hyperbolic substitutions based on the trigonometric identities $$1-\sin^2 x=\cos^2 x,\quad 1+\tan^2 x=\sec^2x, \quad \sec^2x-1=\tan^2 x$$ and on the hyperbolic identities $$1-\tanh^2 x=\operatorname{sech}^2 x,\quad 1+\sinh^2 x=\cosh^2 x, \quad\cosh^2 x-1=\sinh^2 x$$ are in general faster. For example for $\sqrt{a^2-x^2}$ you can use $x=a\sin t$ or $x=a\tanh t$.

*Note that if you use the trigonometric substitution $x=2\sin t-1$ suggested by
lab bhattacharjee, instead of the one I indicate above, the two constants of integrations are not equal. 

</s>