Let $A$ be a complex, square matrix, and define the geometric sum $$S = I+A+\cdots + A^{N-1}. \tag{1} $$ Just like in the scalar case, one can expand and see that $$(A-I)S =A^N-I, \tag{2} $$ and hence, provided that $A-I$ is invertible, we get $$S=(A-I)^{-1} (A^N-I) . \tag{3}$$ In the scalar case, the corresponding formula $$s=\frac{a^n-1}{a-1} , \tag{4}$$ exhibits a removable singularity at the point $a=1$. That is, one can use the formula with $a \neq 1$, in order to get the right value of $s$ (which is $s=n$) when $a=1$ using limits (e.g. l'Hôpital's rule, or even simpler --- the definition of the derivative of $a \mapsto a^n$ at the point $a=1$).
My question is about similar results in the matrix case: The singularities in Equation $(3)$ occur whenever $\det(A-I) =0$ (that is whenever $A$ has $\lambda =1$ as an eigenvalue). Can one use Equation $(3)$ with $A-I$ non-singular, in order to get the right interpretation of Equation $(3)$ with $A-I$ singular? Is there some appropriate matrix analogue of l'Hôpital's rule? Any other limiting process?
Thank you!