second cohomology
Suppose you want to build a bigger group out of a normal subgroup A and a quotient Q, knowing how Q acts on A. There may be many non-isomorphic ways to glue them together, and there may be none at all if the gluing data is inconsistent. The second cohomology group is the exact ledger of these possibilities: each gluing is a 2-cocycle, two gluings that produce equivalent groups differ by a 2-coboundary, and the zero class is the obvious gluing — the semidirect product.
For a group Q and a Q-module A, H^2(Q, A) = Z^2(Q, A) / B^2(Q, A). A 2-cocycle is a function f : Q^2 -> A (a factor set) satisfying the identity g·f(h, k) - f(gh, k) + f(g, hk) - f(g, h) = 0, which is exactly the associativity constraint needed to define a group law on A × Q with twisted multiplication. Coboundaries correspond to reparametrizing the chosen section of the extension. The result classifies extensions 1 -> A -> E -> Q -> 1 inducing the given action, up to equivalence.
More generally H^2 is an obstruction group throughout algebra: it controls when a partial structure can be completed (e.g., lifting a homomorphism, deforming an algebra, or realizing a Brauer class). In Galois cohomology H^2(Gal(L/K), L^*) embeds into the Brauer group and classifies central simple algebras split by L. The same H^2 also detects whether a projective representation lifts to an honest linear representation, the obstruction being a class in H^2(Q, C^*).
With Q = Z/2Z acting trivially on A = Z/2Z, one finds H^2(Z/2Z, Z/2Z) = Z/2Z. The nonzero class is realized by the extension 1 -> Z/2Z -> Z/4Z -> Z/2Z -> 1, whose nonsplitness (Z/4Z is not Z/2Z × Z/2Z) is exactly the nontrivial cohomology class.
Z/4Z versus the Klein four-group: the same Q and A, two extension classes.
The zero class of H^2 corresponds to the split extension (the semidirect product); a nonzero class means no section is a homomorphism, so the extension is genuinely twisted. This is why H^2(Q, A) = 0 forces every extension with that action to split.