Question: Evaluate the integral $$\int \frac{dx}{1+k+(1-k)x^2}$$ for all values of $k \in \mathbb{R}$.

Now when $-1 \le k \le 1$ this integral is trivial by using inverse tangent substitution. 

But this doesn't work when $|k|>1$. So why can't you evaluate the integral using this method, and how do you evaluate it then? (especially when $k$ is negative)

Is it possible to work out the definite integral with respect to $x$ from $0$ to $1$?

Answer: 
For $k > 1$, we can rewrite the integral as
$$\frac{1}{k + 1} \int \frac{dx}{1 - \frac{k - 1}{k + 1} x^2} = \frac{1}{k + 1} \int \frac{dx}{1 - \left(\sqrt{\frac{k - 1}{k + 1}} x\right)^2},$$
which suggests the substitution $\sin \theta = \sqrt{\frac{k - 1}{k + 1}} x$ (or a suitable hyperbolic substitution, or partial fractions, though the last of these works out to be slightly messy).

The case $k < -1$ can be handled similarly.
The antiderivative is equal to $$\frac{1}{1-k}\sqrt{\frac{1-k}{1+k}}atan(\sqrt{\frac{1-k}{1+k}}x)$$ for k not equal to 1 or -1 and if $\frac{1-k}{1+k}$ >=0. The case k=1 is trivial. For k=-1 the antiderivative is $$\frac{-1}{2x}$$
If $\frac{1-k}{1+k}$ <0 the you can use simple fraction to integrate.