The proof in question can be found here: Combinatorial Proof Of A Number Theory Theorem--Confusion
In cases where we attempt the process described in this proof with some non-prime $p$ for the necklace length, the proof fails to work because some cyclic permutations of a necklace of composite length may be identical to each other. For example, with $p=6$, and with the colors $B$ and $W$, we have the necklace: $BWBBWB$, which does not correspond to six distinct permutations, but only to three. Thus, we do not end up showing that $6|(2^6-2)$, and indeed it does not. Great.
In a discussion at a related question (Why need prime number in Fermat's Little Theorem), a question arose. In the non-prime case, is there a nice way to quantify the extent to which the proof breaks down? If $p$ is composite, can we write down a nice formula that counts the number of necklaces that appear fewer than $p$ times, and thus write $a^p-a$ as the sum of a multiple of $p$ and some other terms that depend on $p$ and $a$? Does the resulting error term reveal some number theoretic property of $p$?