Step 1: Factor the denominator.
We can factor the denominator using the difference of squares formula:
\[
x^2 - a^2 = (x - a)(x + a).
\]
Thus, the integral becomes:
\[
\int \frac{dx}{(x - a)(x + a)}.
\]
Step 2: Use partial fraction decomposition.
We can decompose the integrand as:
\[
\frac{1}{(x - a)(x + a)} = \frac{A}{x - a} + \frac{B}{x + a}.
\]
Multiplying both sides by \((x - a)(x + a)\), we get:
\[
1 = A(x + a) + B(x - a).
\]
Expanding and simplifying:
\[
1 = A(x) + Aa + B(x) - Ba,
\]
\[
1 = (A + B)x + (Aa - Ba).
\]
Equating the coefficients of \(x\) and the constants, we get:
\[
A + B = 0, Aa - Ba = 1.
\]
From \(A + B = 0\), we have \(B = -A\). Substituting into the second equation:
\[
Aa - A(-a) = 1,
\]
\[
2aA = 1 $\Rightarrow$ A = \frac{1}{2a}, B = -\frac{1}{2a}.
\]
Step 3: Substitute back into the integral.
Now the integral becomes:
\[
\int \left( \frac{1}{2a} \left( \frac{1}{x - a} \right) - \frac{1}{2a} \left( \frac{1}{x + a} \right) \right) dx.
\]
This simplifies to:
\[
\frac{1}{2a} \int \left( \frac{1}{x - a} - \frac{1}{x + a} \right) dx.
\]
Step 4: Integrate each term.
We know that the integral of \(\frac{1}{x - a}\) is \(\log|x - a|\) and the integral of \(\frac{1}{x + a}\) is \(\log|x + a|\). Thus, we have:
\[
\frac{1}{2a} \left( \log|x - a| - \log|x + a| \right).
\]
This simplifies to:
\[
\frac{1}{2a} \log \left| \frac{x - a}{x + a} \right| + C.
\]
Step 5: Conclusion.
The correct answer is (B) \(\frac{1}{2a} \log \left| \frac{x - a}{x + a} \right| + C\).