If $G$ is a semigroup with a right-neutral element ($\exists\ e\ \forall a \in G: a e = a $) and there are right-inverses for all elements ($\forall a \in G \ \exists a^{-1}: a a' = e$), then $G$ is a group.
This can be shown by some calculations, were you show that the right-inverse is also a left inverse and that the right-neutral is a neutral element (like: $a a' = e, a'a'' = e, ae=a$; then $a = ae = aa'a''=ea''=eea''=ea=a''$, so $a=a''$ and $ae = ea$).
Conversely (as also has been discussed here: Why is a monoid with right identity and left inverse not necessarily a group?) if you have right-inverse and left-neutral this is not the case. Which can be shown be a simple counterexample (like $G=\{e,a\}$ with $ee=e, ea=a, ae=e, aa=a$, this "contracts" to the right thus is associative but is no group since there is no unique (right/left)neutral).
Now my (maybe very soft) question: Can this result also be "derived" directly from some more general principle (like more general theorem) as a special case? The question arises to me since it is somehow not very enlightening (at least to me) having to rely on the fact that you somehow come up with the correct equations to show that you actually must have the group. I feel there might be something more to understand. (In case it doesn't make all to much sense sorry for that).