Tom and Jerry picktogether randomly pick out a pair of parking spaces.
There are $\binom{n}2$ equiprobable pairs of parking spaces.
$n-1$ of the pairs consist of spaces that are not separated by any empty space.
$n-2$ of the pairs consist of spaces that are separated by exactly one empty space.
So: $$(n-1)+(n-2)=2n-3$$ of the pairs consist of spaces that are separated by at most one empty space.
Then the probability that Tom and Jerry pick out a pair consisting of spaces that are separated by at most one empty space equals:$$\frac{2n-3}{\binom{n}2}=\frac{4n-6}{n(n-1)}$$This based on the rule that probability equals number of favourable outcomes divided by number of possible outcomes. This rule works if the outcomes are equiprobable.