I was wondering recently about all this theory behind the classification of extensions of algebraic structures like groups, Lie algebras etc. Seems to be a nice question and even better a nice answer what's the possible extensions of a group (Lie Algebras) $G$ by $H$. To do that so, we usually introduce some kind of homological/categorical algebra and we come up with fancy answers containing the 2nd, 3rd cohomology, derivation algebras.
So, a natural question came up in my head; as always there must be a reasonable question behind this rather complicated setup (usually of a more geometric flavor not easily distinguished), hence my question is:
What's the (original) motivation behind the idea of searching the problem of extensions between some kind of algebraic structures?
P.S.
If the above question is/seems broad please you can concentrate to groups or Lie algebras. Historical surveys, recommended textbooks or online handouts are more than welcome.
Thank you for your time!