There are $p$ points on every line. The lines through a given point can go through every other point, and two distinct ones have only that point in common, so there are
$$
\frac{p^{3} - 1}{p-1} = 1 + p + p^{2}
$$
lines through a point.
If you count the number of lines as
$$
\text{number of points} \cdot \text{number of lines through each point}
=
p^{3} \cdot (1 + p + p^{2}),
$$
then you are counting each line $p$ times, one for each of its points, so the number of lines is
$$
p^{2} \cdot (1 + p + p^{2}).
$$
Gerry Myerson (thanks!) made me notice that I had forgotten to count planes.
One way is the following. Count first the triples of distinct, non-collinear points. Their number is
$$
p^{3} (p^{3} -1) (p^{3} - p).
$$
To count planes, we have to divide by the number of triples of distinct, non collinear points on a given plane, that is
$$
p^{2} (p^{2} -1) (p^{2} - p).
$$
The net result is
$$
\frac{p^{3} (p^{3} -1) (p^{3} - p)}{p^{2} (p^{2} -1) (p^{2} - p)}
=
p (p^{2} + p + 1).
$$
The same method allows for an easier counting of the lines, as
$$
\frac{p^{3} (p^{3} - 1)}{p (p-1)}
=
p^{2} (p^{2} + p + 1).
$$