I consider k-ary strings of the form $a_1 \cdots a_n$ where $a_i \in \{0,\ldots,k-1\}$ for $1\le i \le n$. A necklace is the lexicographically smallest representative of an equivalence class where two strings are said to be equivalent if one is a rotation of the other (wiki). The number of all necklaces can be counted using Polya's enumeration theorem.

Now, let $1 \le j \le n$ be fixed. What is the number of necklaces with the additional constraint $a_j = k-1$? Is there a closed form expression for this number?