If $\beta:T\rightarrow S$ exists with $\beta\alpha=id_{S}$ then
we find easily that $\alpha\left(s\right)=\alpha\left(s'\right)$
implies that $s=\beta\alpha\left(s\right)=\beta\alpha\left(s'\right)=s'$
showing that $\alpha$ is injective.
Conversely let $\alpha:S\rightarrow T$
be injective. If $s_{0}\in S$ then we can construct $\beta:T\rightarrow S$
by sending each element $t=\alpha\left(s\right)\in\alpha\left(S\right)$
to the unique $t\in T$. Elements not contained in $\alpha\left(S\right)$
can be sent to $s_{0}$. Then $\beta\alpha=id_{S}$. Note however
that this does not have to work if $S=\emptyset$. We have the unique empty
map $\alpha:\emptyset\rightarrow T$ wich is vacuously injective.
Only if also $T=\emptyset$ then there exist the empty map $\beta:T=\emptyset\rightarrow\emptyset$
and indeed $\beta\alpha=id_{\emptyset}$. However, if $T\ne\emptyset$ then
no map $\beta:T\rightarrow\emptyset$ exists.
So the statement: if
$\alpha:S\rightarrow T$ is injective then $\beta\alpha=id_{S}$ for
some $\beta:T\rightarrow S$, is true under the extra condition that
$S\ne\emptyset\vee T=\emptyset$.
If $S$ is a singleton then automatically
$\beta$ is unique. However, if moreover $T$ is not a singleton then
$\alpha$ is not a bijection. So uniqueness of $\beta$ does not imply
that $\alpha$ is bijective. For this we need the extra condition that $S$ is no singleton or $T$ is a singleton.
If $\alpha\beta=id_{T}$ then $t=\alpha\left(\beta\left(t\right)\right)$
for each $t\in T$ showing immediately that $\alpha$ is surjective.
Conversely let $\alpha:S\rightarrow T$ be surjective. Then we construct
$\beta:T\rightarrow S$ by sending each element $t$ by one of an
elements $s\in S$ that suffices $\alpha\left(s\right)=t$. Then automatically
$\alpha\beta=id_{T}$. Note that this equation implies that $\beta(t)$ belongs to fibre $\alpha^{-1}\left(\left\{ t\right\} \right)$, so that is necessary.
If this $\beta$ with $\alpha\beta=id_{T}$ is unique
then for each $t\in T$ the fibre $\alpha^{-1}\left(\left\{ t\right\} \right)$
contains exactly one element. This tells us that the surjective $\alpha$
is also injective, hence bijective.
In category Sets every epimorphism (surjection) is a retraction (second case), but not every monomorphism (injection) is a section (first case). Exceptions are the elements in $\mathbf{Sets}\left(\emptyset,T\right)$ where $T\ne\emptyset$. They are injective but are not sections.
I have been working with sets. If you are working in groups, rings, et cetera then the underlying sets will not be empty.