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}   $$


Yes, below are hints for $3$ proofs, using congruences, Binomial Theorem, and Taylor series.
$(1)\ \ {\rm mod}\ x\!−\!1\!:\ x\equiv 1\,\Rightarrow\,x^2\equiv 1\,\ldots\,\Rightarrow\,x^n\equiv 1\,$  by the Congruence Product/Power Rule. 
$(2)\ \ x^n = (1 +  x\!-\!1)^n = 1 + n(x\!-\!1) + (x\!-\!1)^2(\cdots)\,\Rightarrow\, \dfrac{x^n-1}{x-1}\equiv n\pmod{x\!-\!1}$
$(3)\ \ f(x) = f(1) + f'(1) (x-1) + (x\!-\!1)^2(\cdots)\,\Rightarrow\, \dfrac{f(x)-f(1)}{x\!-\!1}\equiv \color{#c00}{f'(1)}\pmod{x\!-\!1}$
For $\, f(x) = x^n\ $ we have $\,f'(x) = n x^{n-1}$ therefore $\,\color{#c00}{f'(1) = n}.\ $
This be viewed as a double root test, e.g. see this answer.
