A Bilinear Pairing has many properties including
$e(A^\alpha, B) = e(A, B^\alpha) = {e(A, B)}^{\alpha}$ (where $\alpha$ is a scalar)
i.e. you can move the exponent of the left hand side term to the right hand side or you can move it outside of the $e$ map itself.
(In your example, $A = B$)
Polynomial Restriction Check
The verifier needs to check if
$p' = p^\alpha$
This can be checked by checking if
$g^{p'} \stackrel {?}{=} g^{p^\alpha}$
Let $m = g^p$.
So, the check becomes
$g^{p'} \stackrel {?}{=} m^\alpha$
Using Bilinear Pairings,
$e(g^{p'}, g) \stackrel {?}{=} e(m^\alpha, g)$
As per the properties of bilinear pairings, the $\alpha$ can be moved to the other side, so
$e(g^{p'}, g) = e(m, g^\alpha) = e(g^p, g^\alpha)$
So he needs to check if
$e(g^{p'}, g) \stackrel {?}{=} e(g^p, g^\alpha)$$
If the above check is true, then it means
$p' = p^\alpha$
Cofactors check
The verifier needs to check if $p = t(s)\star h$
This will be true if
$e(g^p, g) = e(g^{t(s)\star h}, g)$
Now, since
$x^{a\star b} = x^{a^b}$
$e(g^p, g) = e(g^{{t(s)}^ h}, g)$
Again as per the properties of Bilinear Pairings, the $h$ can be moved to the 2nd parameter, i.e. the verifier needs to check
$e(g^p, g) \stackrel {?}{=} e(g^{t(s)}, g^h)$
If the above is true, then it means
$p = t(s)\star h$
Vitalik's post on Pairings gives more info about how you can check equalities with pairings
https://medium.com/@VitalikButerin/exploring-elliptic-curve-pairings-c73c1864e627
I have rewritten a statement from his post in multiplicative notation
Pairings go a step further in that they allow you to check certain kinds of more complicated equations on elliptic curve points — for example, if $P = g ^ p$, $Q = g ^ q$ and $R = g ^ r$, you can check whether or not $p \star q = r$, having just $P$, $Q$ and $R$ as inputs.