If n is a power of 2, you can divide it by 2 repeatedly until you reach 1. At each step, n mod 2 must be 0 (no remainder). Any power of 2 is even at every step until you hit 1.
Example: n = 16. Check 16 % 2 = 0, divide to get 8. Check 8 % 2 = 0, divide to get 4. Check 4 % 2 = 0, divide to get 2. Check 2 % 2 = 0, divide to get 1. Done. All checks passed.
If at any point n mod 2 = 1 (n is odd and greater than 1), then n is not a power of 2. Also handle n ≤ 0 as false since negative numbers and zero cannot be powers of 2.