A semigroup is a magma whose operation is associative: for all elements a, b, c. Associativity means that the order of performing operations does not matter — you can drop the parentheses. The expression is unambiguous.
Associativity is the first axiom that most of mathematics needs. Without it, even simple chains of operations become ambiguous — might differ from , and you would need parentheses everywhere. With it, you can talk about “the product of a, b, and c” without specifying grouping.
A semigroup with an identity element is a monoid. A monoid with inverses is a group. The positive integers under addition form a semigroup but not a monoid, since 0 is excluded and there is no identity. The set of all strings over an alphabet under concatenation is a semigroup and a monoid, with the empty string as identity.
Semigroups are the minimal structure needed for sequential composition. In a category, the collection of endomorphisms of any object (morphisms from the object to itself) forms a monoid under composition. Forgetting the identity morphism leaves a semigroup. Associativity of composition is one of the two axioms of a category — it comes from the semigroup level of the algebraic hierarchy. The other axiom, the identity law, comes from the monoid level.