Surjective endomorphisms of finitely generated modules are isomorphisms 
My Problem: Let $M$ be a finitely generated $A$-module and $T$ an endomorphism. I want to show that if $T$ is surjective then it is invertible. 

My attempt:
Let $m_1,...,m_n$ be the generators of $M$ over $A$. For every $b = b_1 m_1 + ... + b_n m_n$ with $b_i \in A$ there is $a = a_1 m_1 + ... + a_n m_n$ with $a_i \in A$ such that 
$$ T(a)=b $$
or in matrix-vector notation
$$ T \vec{a} = \vec{b} $$
where $\vec{x}$ is the column vector of $x_1,...,x_n$ where $x = x_1 m_1 + ... + x_n m_n$. I multiply by the adjugate matrix to get
$$ \mathrm{adj}(T) \vec{b} = \mathrm{adj}(T) T \vec{a} = \det(T) I_n \vec{a} = \det(T) \vec{a} \ .
$$
Now take $\vec{b}=0$. Then $\vec{0} = \det(T) \vec{a}$ and thus $T$ is injective if and only if
$\det(T)$ is not a zero divisor. 
If I prove that $T$ is injective, then I'll get it is invertible. For that, I think the way is to prove that $\det(T)$ is not a zero divisor.
The importance of finitely generated condition:
Let $M = A^{\aleph_0} =\{ ( a_1 , a_2 , ... ) \mid a_i \in A \}$ be a not finitely generated $A$-module. Let $T : M \to M$ defined by
$$ T(a_1, a_2, a_3, ... ) = (a_2, a_3, ... ) \ . $$
Then clearly $T$ is surjective but not injective ($\ker T = \{ ( a , 0 , 0 , ... ) \mid a \in A \}$),
and thus not invertible.
The importance of surjective and not injective condition:
Need to find a counter-example.
 A: Yes, a surjective $A$-linear endomorphism $T:M\to M$ of a finitely generated $A$-module  $M$ is an isomorphism.    
Proof
Consider $M$ as an $A[X]$-module via the multiplication $P(X)*m=P(T)(m)$ , so that for example $(X^2-7)*m=T(T(m))-7m$.
[this is a classical trick used in advanced linear algebra].
 Surjectivity of $T$  translates into  $M=XM$ and so a fortiori for the ideal $I=XA[X]$ we have $M=IM$.
Now Nakayama's lemma  comes to our rescue : it says that there exists an element  $XQ(X)\in I$ such that $(1-XQ(X))*m=0$ for all $m\in M$, which means that $m=TQ(T)m$ and this immediately implies that $T$ is invertible  with inverse $T^{-1}=Q(T)$.  
This result and its extremely elegant proof are due to Vasconcelos.
And if, like so many of us , you keeep forgetting  what Nakayama says, look here.   
Caveat
Of course  an injective endomorphism of a finitely generated module needn't be surjective: take $A=\mathbb Z$ and $T:\mathbb Z\to\mathbb Z:m\mapsto 2m$ !
A: Here is a quick and easy proof which I have found at the stacks project: If $M$ is cyclic, then $M \cong A/I$ for some ideal $I$. Then replace $A$ by $A/I$ so that wlog $M = A$. But then it's easy. In general, we do induction, but first we do the trick mentioned in Georges Elencwajg's answer: We endow $M$ with an $A[X]$-module structure such that multiplication with $X$ is the given endomorphism $T$. Thereby, we may assume that $T$ is multiplication with an element $X$ of the base ring $A$ - this means that every submodule is stable under this endomorphism(!). So we just pick some generator, look at its generated submodule $M'$ and apply the Five Lemma to
$$\begin{array}{c} 0 & \rightarrow & M' & \rightarrow & M & \rightarrow & M/M' & \rightarrow & 0 \\ & & X\downarrow ~~~~&& X\downarrow ~~~~ && X \downarrow ~~~~ & & \\ 0 & \rightarrow & M' & \rightarrow & M & \rightarrow & M/M' & \rightarrow & 0\end{array}$$
and we are done.
A: The following proof is based on the paper:
"Onto Endomorphisms are Isomorphisms", Amer. Math. Monthly 78 (1971), 357-362 by 
Morris Orzech, Queen's University.
I was told about this paper by KCd in this thread.
The idea is to reduce the theorem to an easy case where $A$ is a Noetherian ring.
Lemma (a slight generalization of Atiyah-Macdonald's Exercise 6.1)
Let $A$ be a not-necessarily commutative ring.
Let $M$ be a Noetherian $A$-module.
Let $N$ be an $A$-submodule of $M$.
Let $f\colon N \rightarrow M$ be a surjective $A$-homomorphism.
Then $f$ is injective.
Proof
Let $K_n = \ker(f^n)$, $n = 1, 2,\dots$.
Since $M$ is Noetherian, there exists $n$ such that $K_n = K_{n+1} = \cdots$.
Let $x \in K_1$.
Since $f$ is surjective, there exist $x_2, \dots, x_n$ such that
$x = f(x_2)$
$x_2 = f(x_3)$
$\dots$
$x_{n-1} = f(x_n)$
$x_n = f(x_{n+1})$
Since $x_{n+1} \in K_{n+1}$, $x_{n+1} \in K_n$.
Hence $f^n(x_{n+1}) = 0$.
Hence $x = f(x_2) = f^2(x_3) = \cdots = f^n(x_{n+1}) = 0$.
QED
Theorem (a generalization of the theorem of Vasconcelos).
Let $A$ be a commutative ring.
Let $M$ be a finitely generated $A$-module.
Let $N$ be an $A$-submodule of $M$.
Let $f\colon N \rightarrow M$ be a surjective $A$-homomorphism.
Then $f$ is injective.
Proof
Let $0 \neq y_0 \in N$.
It suffices to prove $f(y_0) \neq 0$.
Let $f(y_0) = x_0$.
Let $x_1, \dots, x_n$ be generators for $M$.
Let $f(y_i) = x_i$, $i = 1,\dots, n$.
Suppose $f(x_i) = \sum_{j = 1}^{n} a_{i, j} x_j, i = 0, 1,\dots, n$ and
$y_i = \sum_{j = 1}^{n} b_{i, j} x_j, i = 0, 1,\dots, n$.
Let $B = \mathbb{Z}[a_{i, j}, b_{i, j}]$. $B$ is a Noetherian subring of $A$.
Let $P = Bx_1 + \cdots + Bx_n$, $Q = By_0 + By_1 + \cdots + By_n$.
Since $y_i \in P, i = 0, 1, ..., n, Q \subset P$.
Since $f(y_i) = \sum_{j=1}^{n} b_{i, j} f(x_j) \in P, f(Q) \subset P$.
Hence $f$ induces a $B$-homomorphism $g\colon Q \rightarrow P$.
Since $f(y_i) = x_i, i = 1,\dots, n$, $g$ is surjective.
Hence, by the lemma, $g$ is injective.
Hence $f(y_0) = g(y_0) \neq 0$ as desired.
QED
A: By an application of the snake lemma, you can reduce to the case $M=A^r$, i.e. $M$ is a free $A$-module.
So you have an exact sequence
$$ 0 \to \ker T \to A^r \stackrel T \to A^r \to 0 $$
These are free modules, so the sequence splits, i.e. we can write the middle one as $\ker T \oplus \text{im } T$:
$$ 0 \to \ker T \to \ker T \oplus A^r \stackrel T \to  A^r \to 0 $$
Now, the only way dimensions can add up here, is if $\ker T = 0$. So $T$ is an isomorphism. (this is perhaps unnecessarily complicated, but it works) (this was wrong, but see the comments for the details on how to reduce to free modules. Perhaps they admit an easier proof.)
A: Consider the commutative ring $B\subset\mathrm{End}_A(M)$ generated by $T$ and all multiplication by $a\in A$ maps, i.e. the maps $\mathsf{m}_a:M\to M, m\mapsto am$. Let $m_1,\dots,m_n$ generate the $A$-module $M$. We can find a matrix $(b_{ij})\in M_n(A)$ with $$\forall j\in\{1,\dots,n\},\quad Tm_j=\sum_{i=1}^n b_{ij}m_i$$ The usual "multiplication by the comatrix" trick done in the commutative ring $B$ shows that $T$ satisfies a monic polynomial equation $$T^n+\sum_{i=0}^{n-1}b_i T^i=T^n+\cdots+(-1)^n\mathsf{m}_\beta=0$$ with coefficients $b_i$ in $A$ and where we wrote $\beta=\det(b_{ij})$.

Since $T$ is onto, the $Tm_i$ generate $M$ and there is a matrix $(a_{ij})\in M_n(A)$ with $$\forall j\in\{1,\dots,n\},\quad m_j=\sum_{i=1}^n a_{ij}Tm_i$$ so that $$(a_{ij})(b_{ij})\begin{pmatrix}m_1\\\vdots\\m_n\end{pmatrix}=\begin{pmatrix}m_1\\\vdots\\m_n\end{pmatrix}$$ and so (again using the comatrix trick) $\mathsf{m}_\alpha\circ\mathsf{m}_\beta=\mathrm{id}_M$ where $\alpha=\det(a_{ij})$. Therefore, composing the monic polynomial relation from earlier with $\mathsf{m}_\alpha$, we get $$\mathrm{id}_M=ST=TS$$ with $S=(-1)^{n-1}\alpha\big(T^{n-1}+\sum_{i=1}^{n-1}b_i T^{i-1}\big)$ showing that $T$ is invertible with inverse $S$.
