I learned you should use integration by partial fractions when the discriminant $D\ge0$ but are you allowed to use it in other cases?
For example take the integral $I=\int{2x-1\over x^2+1}dx$
The traditional way to solve it is:
$$I=\int{d(x^2+1)\over x^2+1}-\int{dx\over x^2+1}=\ln(x^2+1)-\arctan(x)+c_1$$
With partial fractions: $${2x-1\over x^2+1}=\frac{A}{x+i}+\frac{B}{x-i}=\frac{(A+B)x+(B-A)i}{x^2+1} \\ \Leftrightarrow \left\{ \begin{array}{c} A+B=2 \\ (B-A)i=-1 \\ \end{array} \right.\Leftrightarrow \left\{ \begin{array}{c} B=2-A \\ (B-A)=i \\ \end{array} \right.\Leftrightarrow \left\{ \begin{array}{c} B={2+i\over2} \\ A={2-i\over2} \\ \end{array} \right. \\ \Leftrightarrow I=A\int{dx\over x+i}+B\int{dx\over x-i}={2-i\over2}\ln|x+i|+{2+i\over2}\ln|x-i|+c_2$$
Is this correct?
How does ${2-i\over2}\ln|x+i|+{2+i\over2}\ln|x-i|+c_2$ simplify to $\ln(x^2+1)-\arctan(x)+c_1$? I checked for $x=0$ and the constants aren't equal.
The formula $\int \frac 1 {x+i} \, dx =\ln |x+i|$ is not valid. In fact the left side is a complex valued function and the right side is real valued. You have borrowed a formula valid for real the real case and applied it to the case.