The proof assumes unique prime factorization. Once we factor p as 2^a 3^b 5^c etc., then we know that p^2 factors as 2^(2a) 3^(2b) 5^(2c) etc. This is (implicitly) how we know that p^2 contains exactly twice as many powers of 2 as p.
If √2 is rational, then √2 can be written as z/y for some integers z and y, where z and y are coprime. Then, 2=z²/y².
Consider the hypothetical integer z. It is equal to √2*y. Since y and z are coprime, y cannot contain a factor of √2. Thus, z does not contain a factor of 2; the highest integer power of 2 that is a factor of z is 2^0.
On the other hand, z² does have a factor of 2; it is equal to 2*y² (since y has no factor of √2, y² therefore has no factor of 2).
Therefore, to claim that p² contains exactly twice as many powers of 2 as p is exactly equivalent to claiming that √2 is irrational.
Here's the new thread for posting quotes, with the usual rules: