All indices are considered modulo $n$.
Number the lamps $1$ through $n$. Represent each configuration of lamps by a binary vector of length $n$, where the $i^{\text{th}}$ component of the vector is $1$ if the corresponding lamp is on and $0$ otherwise. Next, remark that each series of operations can be represented by a binary vector of length $n$, where the $j^{\text{th}}$ component of the vector is $1$ if we change the state of lamps $j, j + 1, \dots, j + k - 1$ and $0$ otherwise. Finally, let $A$ be the matrix over $\mathbb{F}_2$ such that $a_{ij} = 1$ if and only if $j - i \in \{0, 1, \dots, k - 1 \}$. It is clear that the number of configurations of $n$ lamps we can get to by performing some number of operations is $2^{\text{rank}(A)} = 2^{n - \text{nullity}(A)}$ by rank-nullity.
Let $v = \langle v_1, v_2, \dots, v_n \rangle$. If $v \in \text{ker}(A)$, we need, for all $i$, $v_i = v_{i + k} = v_{i + 2k} = \dots = v_i$. Let $g = \gcd(n, k)$. It is fairly easy to compute the nullity of this matrix now; if $k/g$ is odd, the nullity is $g - 1$. If $k/g$ is even, the nullity is $g$. Then we can hit exactly $2^{n - \gcd(n, k) + 1}$ configurations if $k/\gcd(n, k)$ is odd, and $2^{n - \gcd(n, k)}$ if $k/\gcd(n, k)$ is even.
Either I have made some fatal algebra mistake or it doesn't really make sense to characterize $k$ by its primality or parity.