========================
Explanation:
We have a pair of (x+1) terms. One is up top in the numerator. The other is down below in the denominator. The pair of terms cancel out when we divide. So we go from this
( (x-7)(x+1) )/( (x+1)(x-5) )
to this
(x-7)/(x-5)
after the cancellations.
The "x cannot equal 5 or -1" is to ensure we don't have division by zero errors.