I am trying to understand the particular argument in Lemma 15.102.2's proof. It writes that if $M$ is invertible $R$-module, then
we have an automorphism $M \rightarrow M$ which factors as $$M \rightarrow R^n \rightarrow M.$$
Then it says $M$ is a direct summand of $R^n$. How is this so?
In this case, there are homomorphisms $\phi:R^n\to M$ and $\psi:M\to R^n$ with $\psi\circ\phi=\text{id}_M$. Then $R^n$ is the direct sum of $\text{im}\,\psi$ and $\ker\phi$.