As first step we may use the common denominator $(x^{2}-4)=(x-2)(x+2)$
because the $\text{lcm}\left( (x-2)(x+2),(x+2)\right) =(x-2)(x+2)$
$$
\begin{eqnarray*}
\frac{x^{2}}{(x^{2}-4)}-\frac{x+1}{x+2} &=&\frac{x^{2}}{(x-2)(x+2)}-\frac{
\left( x+1\right) (x-2)}{\left( x+2\right) (x-2)} \\
&=&\frac{x^{2}-\left( x+1\right) (x-2)}{(x-2)(x+2)}.\tag{1}
\end{eqnarray*}
$$
Otherwise we would get the equivalent but more more complex fraction
$$
\frac{x^{2}}{(x^{2}-4)}-\frac{x+1}{x+2}=\frac{x^{2}\left( x+2\right) -\left(
x+1\right) (x^{2}-4)}{(x^{2}-4)\left( x+2\right) }.
$$
Expanding the second term of the numerator of $(1)$
$$
\begin{eqnarray*}
\left( x+1\right) (x-2) &=&x(x-2)+(x-2)=x^{2}-2x+x-2 \\
&=&x^{2}-x-2
\end{eqnarray*}
$$
and substituting into the fraction we get
$$
\frac{x^{2}-\left( x^{2}-x-2\right) }{(x-2)(x+2)}=\frac{x^{2}-x^{2}+x+2}{
(x-2)(x+2)}=\frac{x+2}{(x-2)(x+2)},\tag{2}
$$
which for $x+2\neq 0$ simplifies to
$$
\frac{1}{x-2}\tag{3}
$$
Added: In general we transform the sum (or difference) of two given rational fractions (the numerator and denominator consists of polynomials) into a
single equivalent fraction, by using properties such as
- $$\frac{A(x)}{B(x)}=\frac{A(x)P(x)}{B(x)P(x)}\qquad\text{for }P(x)\neq 0.$$
- $$\frac{A(x)}{B(x)}\pm \frac{C(x)}{D(x)}=\frac{A(x)D(x)\pm B(x)C(x)}{B(x)D(x)}.$$
- $$\frac{A(x)}{B_1(x)B_2(x)}\pm \frac{C(x)}{B_2(x)}=\frac{A(x)\pm B_1(x)C(x)}{B_1(x)B_2(x)}.$$