How do 3 fractions having respectively $(a-x)^2$ , $(a+x)^2$ and $(a-x)$ as denominators add up to a fraction having $(a^2 - x^2)^2$ as denominator?
Your calculations are correct, but you slip up when it comes to what you actually do to the denominator to add fractions.
Specifically, when you multiply each addand fraction by a form of $1$ to get get a common denominator, that denominator is not (necessarily) the product of the individual denominators, but their least common multiple.
That noted, it should be clear that
$${\rm lcm}((a-x)^2,(a+x)^2,a-x)=(a-x)^2(a+x)^2=(a^2-x^2)^2$$
$\require{cancel}$
We do not need the product of all denominators if one is a factor of another. For instance
$$\quad \dfrac{1}{3}+\dfrac{1}{4}+\dfrac{1}{8}\\ =\dfrac{8}{24}+\dfrac{6}{24}+\dfrac{3}{24}$$ where the denominator is $\space LCM(3,4,8)=24$ and not $3\times4\times8=96$
$$LCM \big((a-x)^2 , (a+x)^2, (a-x)\big)\\ = (a-x)^2(a+x)^2\cancel{(a-x)}\\ =(a^2-x^2)^2$$