Let $k=\varphi(9n)$, where $\varphi$ is the Euler $\varphi$-function.
By Euler's Theorem, we have $10^{k}\equiv 1\pmod{9n}$.
It follows that $9n$ divides the number whose decimal expansion consists of $k$ $9$'s.
Thus $n$ divides the repunit $R(k)$.
Another way: We can prove the result using a great deal less machinery. For consider the repunits $R(1), R(2), R(3), R(4)$, and so on. For each repunit $R(j)$, imagine calculating the remainder when $R(j)$ is divided by $n$.
There are only $n$ conceivable remainders. It follows that there are repunits $R(i)$, $R(j)$, where $i\lt j$, such that $R(i)$ and $R(j)$ have the same remainder on division by $n$.
It follows that $R(j)-R(i)$ is divisible by $n$. This difference is a repunit $R(k)$ multiplied by a power of $10$. But since $10$ and $n$ are relatively prime, we conclude that $n$ divides $R(k)$.