Proof that every prime has a primitive root. So I encountered this proof on a Number Theory book, I will link the pdf at the end of the post (proof at page 96), it says: "Every prime has a primitive root,
proof: Let p be a prime and let m be a positive integer such that:
p−1=mk for some integer k.  Let F(m) be the number of positive integers of order m modulo p that are less than p. The order modulo p of an integer not divisible by p divides p − 1 , it follows that:
$$p-1=\sum_{m|p-1}F(m)
$$
By theorem 42 we know that:
$$p-1=\sum_{m|p-1}\phi(m)
$$
By Lemma 11,F(m)≤φ(m) when m|(p−1). Together with:
$$\sum_{m|p-1}F(m)=\sum_{m|p-1}\phi(m)
$$
we see that F(m)=φ(m) for each positive divisor m of p−1. Thus we conclude that F(m)=φ(m).  As a result, we see that there are p−1 incongruent integers of order p−1 modulo p. Thus p has φ(p−1) primitive roots.
The part that i don't understand is near the beginning, when he says "The order modulo p of an integer not divisible by p divides p − 1 , it follows that: $$p-1=\sum_{m|p-1}F(m)
$$" How does he conclude that? I understand that the order of the integer must divide p-1 but how does that imply that the summation actually evaluates at p-1?...
Link of the book's pdf: https://www.saylor.org/site/wp-content/uploads/2013/05/An-Introductory-in-Elementary-Number-Theory.pdf

All that is saying is that the sum of the number of elements of each order must add up to the total number of elements in the field, p -1. The summation could have been carried out of "all possible orders," but since "all possible orders" is the same thing as "divisors of p -1," we can carry the summation over divisors of p -1. The summation equation is literally equivalent to the statement that the order of a member of the field must be a factor of p - 1
