Constant of integration change
"Do we need to do change the constant every time there is a gap in the domain [...]?" The answer is Yes: the generic C stands for a locally constant function - a function constant on intervals. The values on disjoint intervals may be different.
To expound a bit on Catalin Zara's answer:
Your answer should give all possible antiderivatives; i.e., if you plug in any particular combination of constants for the generic constants $C_1, C_2, \dots$, you get a function which, when you differentiate, gives you the integrand. So the answer with three constants is more general than the answer with two constants; and you can check that if $C_1$ and $C_3$ are different, you still get a function with derivative $\frac{x^5}{x^2-1}$
Since the specific problem you pose has been nicely solved through Y. Forman's and Catalin Zara's answers, I'd like to add some more "theoritic" information about the way we define the $\int f(x)dx$ and that so-called constant of integration.
Let $\mathcal{D}(\mathbb{R})$ be the set of all differentiable functions $f:\mathbb{R}\to\mathbb{R}$, so: $$\mathcal{D}(\mathbb{R}):=\{f:\mathbb{R}\to\mathbb{R}|f\text{ is differentiable}\}$$
Now, let us consider the following relation in $\mathcal{D}(\mathbb{R})$: $$f\sim g\Leftrightarrow f'(x)=g'(x)$$ It is clear that $\sim$ is an equivalence relation, since:
- $f\sim f\Leftrightarrow f'(x)=f'(x)$ for every $f\in\mathcal{D}(\mathbb{R})$,
- $f\sim g\Rightarrow g\sim f$, since $f'(x)=g'(x)\Leftrightarrow g'(x)=f'(x)$,
- $f\sim g\ \land\ g\sim h\Rightarrow f\sim h$, since $f'(x)=g'(x)\ \land g'(x)=h'(x)\Rightarrow f'(x)=h'(x)$.
So, consider now the quotient space: $$E:=\mathcal{D}(\mathbb{R})/\sim$$
Since $\mathcal{D}(\mathbb{R})$ is a linear space over $\mathbb{R}$, the same applies for $E$.
Now, let us examine which is the zero element of $E$: $$[0]=\{f\in\mathcal{D}(\mathbb{R})|f'=0\}$$ Since, in our case $f$'s domain is always $\mathbb{R}$, $[0]=[c]$ for every $c\in\mathbb{R}$.
Now, let $f,g\in\mathcal{D}(\mathbb{R})$. Then we have that: $$f\sim g\Leftrightarrow[f]=[g]\Leftrightarrow [f]=[g]+[0]\tag{$\star$}$$ Now, let us also introduce the following notation: $$\int f(x)dx:=[f]$$ Then, with the above notation $(\star)$ becomes: $$f\sim g\Leftrightarrow\int f(x)dx=\int g(x)dx+c,\ \text{for some }c\in\mathbb{R}$$ since $[0]=[c]$ for every $c\in\mathbb{R}$, which reminds us of the relation in question.
Now, we can, in a similar way define $\mathcal{D}(A)$, for every $A\subseteq\mathbb{R}$ on which we can define differentiation (e.g. finite unions of open intervals). But, on that case, as has been mentioned, we need to bare in mind that $[0]$ is defined as follows: $$[0]=\{f\in\mathcal{D}(A)|f'=0\}$$ with the notion this has on $A$. So, if $A=(0,1)\cup(1,2)$, every function that is constant on $(0,1)$ and $(1,2)$ seperately - not necessarily with the same value on them - belongs to $[0]$. So, we also have that: $$f\sim g\Leftrightarrow\int f(x)dx=\int g(x)dx+h,\ h\in[0]$$ Now, it is clear that the general case demands to choose different constants on every connected component of the domain $A$.