In order to be able to find an antiderivative, I have been taught to decompose fractions by first observing an identity, like $$\frac{2x+1}{(3x-2)(x+1)} \equiv \frac{A}{3x-2}+\frac{B}{x+1}$$ wherever the function is defined.
Then I would expand and substitute, like so: $$A(x+1)+B(3x-2) \equiv 2x+1$$ letting $x=-1$: $$-5B=-1 \implies B=\frac{1}{5}$$ and then letting $x=\frac{2}{3}$: $$\frac{5}{3}A=\frac{7}{3} \implies A= \frac{7}{5}$$
Why are these substitutions justified? In both cases the original function is undefined for these $x$ values as the denominator would be zero - does this mean my claim "wherever the function is defined" is unnecessary? I can't see why this gives the right answer, but it does (as I can verify by matching coefficients instead of substituting)!
This is indeed an identity in $x$ and therefore is true for all valid values of $x$:
$$\frac{2x+1}{(3x-2)(x+1)} = \frac{A}{3x-2}+\frac{B}{x+1}$$
No, your use of "wherever the function is defined" is not unnecessary.
But note that this also is an identity in $x$ and therefore is true for all valid values of $x$:
$$A(x+1) + B(3x-2) = 2x + 1$$
But this last line has no restrictions on what $x$ can be. Why is this also an identity? Because we obtained it by performing a valid operation (multiplying both sides by the same thing) to an identity in $x$.