general form in congruence Could we generalize this example of congruence issue for $x,n \in \mathbb{Z}_*$?

$$ 1+x+\cdots + x^{n-1}\equiv n \pmod  {x-1}   $$


$$1 \equiv 1 \pmod{ x-1 }$$
Since $x \equiv (x-1)+1$:
$$x \equiv 1 \pmod {x-1}$$
and so:
$$x^2 \equiv 1 \pmod {x-1}$$
$$\dots$$
$$x^{n-1} \equiv 1 \pmod{x-1}$$
So,again,we have:
$$1+x+ \dots + x^{n-1} \equiv 1+1+ \dots +1 \equiv n \pmod {x-1}$$
