Easiest approach is to explain the computation for $~P(X=5).~$ Once you understand this, the other computations will fall into place.
First, there are $~\displaystyle \binom{6}{5}~$ ways of determining which $~5~$ faces will appear. This explains the first factor. So, now you can assume that the problem has been reduced to determining the probability that the faces represented by the elements in $~\{1,2,3,4,5\},~$ appear, and the face represented by the element $~\{6\}~$ does not appear.
Here, I will express the probability as
$$\frac{N}{D} ~: ~D = 6^n ~: n \in \Bbb{Z_{\geq 5}}.$$
First, see this article for an
introduction to Inclusion-Exclusion.
Then, see this answer for an explanation of and justification for the Inclusion-Exclusion formula.
I will follow the syntax in the 2nd linked article above.
Let $~S~$ denote the set of all possible rolls of $~n~$ dice, where the number $~6~$ never appears. Note that some of the elements in $~S~$ represent $~n~$ dice rolls where (for example) the number $~1~$ also does not appear.
For $~k \in \{1,2,3,4,5\},~$ let $~S_k~$ denote the subset of $~S~$ such that the dice roll $~k~$ never appears. Note that in the subset $~S_k~$ there will be elements where some of the other dice roll numbers also do not appear.
Then, the desired computation for $~N~$ is represented by
$$|~S~| - |~S_1 \cup S_2 \cup \cdots \cup S_5~|. \tag1 $$
Let $~T_0~$ denote $~|~S~|.~$
This implies that $~T_0 = 5^n.~$
Let $~T_1~$ denote $~|~S_1~| + |~S_2~| + \cdots + |~S_5~|.~$
By considerations of symmetry,
This implies that $~\displaystyle T_1 = \binom{5}{1} \times 4^n.~$
For $~r \in \{2,3,4,5\},~$ let $~T_r~$ denote
$\displaystyle \sum_{1 \leq i_1 < i_2 < \cdots < i_r \leq 5}
|~S_{i_1} \cap S_{i_2} \cap \cdots \cap S_{i_r}~|.$
That is, $~T_r~$ denotes the summation of $~\displaystyle \binom{5}{r}~$ terms.
By considerations of symmetry,
$$T_r = \binom{5}{r} (5-r)^n. \tag2 $$
Clarification
$T_5 = 0,~$ which corresponds to the fact that $~S_1 \cap \cdots \cap S_5~$ is the empty set. That is, when you have $~n~$ dice rolls, you must have more than $~0~$ numbers appearing.
Clarification
The formula given in (2) above also applies to the computation for $~T_0~$ and $~T_1.$
By Inclusion-Exclusion theory, the computation expressed in (1) above is equivalent to
$$\sum_{r=0}^5 (-1)^r T_r$$
$$= \sum_{r=0}^5 (-1)^r \left[ ~\binom{5}{r} (5-r)^n ~\right].$$
This is consistent with the formula for $~p(X = 5),~$ given in the posted question.