I am reading a Wikipedia article on Ramanujan's sum. The article states that:
It follows from the identity $x^q − 1 = (x − 1)(x^{q−1} + x^{q−2} + ... + x + 1)$ that the sum of the nth powers of All the qth roots of unity is \begin{cases}0&\;{\mbox{ if }}q\nmid n\\q&\;{\mbox{ if }}q\mid n\\\end{cases}
I think I understand the case for $q|n$. Every $q$th root of unity raised to a multiple of $q$ would equal $1$ so the sum is $1+1+1+...+1$ ($q$ summands of $1$). Right?
I also understand that the sum of all the $q$th roots of unity (not raised to any power) is $0$.
I have an intuitive hazy notion that if $q$ does not divide $n$ then the roots upon being raised to the $n$th power are mapped bijectively onto themselves so the sum is $0$.
How can I prove this? How does this follow from the given identity?