Lie algebra cohomology is an algebraic gadget and while there are relations to algebraic topology, I don't think that they are particularly relevant in the context you are looking at. What you need here can be phrased in very elementary terms: Try to define a Lie bracket on $\mathfrak g\times\mathbb C$ by $[(X,z),(Y,w)]=([X,Y],\phi(X,Y))$ with the Lie bracket of $\mathfrak g$ used in the first factor and a bilinear map $\phi$. (This ansatz exactly means that $\{0\}\times\mathbb C$ will be an abelian ideal if the construction defines a Lie bracket.) The result will be skew symmetric if and only if $\phi(Y,X)=-\phi(X,Y)$, so $\phi$ has to be skew symmetric. Moreover, the new bracket satisfies Jacobi identity if and only if $0=\partial\phi(X,Y,Z):=-\phi([x,Y],Z)+\phi([X,Z],Y)-\phi([Y,Z],X)$. This is usually phrased as $\phi$ being a cocycle.
On the other hand, you can ask yourself whether for two cocycles $\phi$ and $\psi$ there is an isomorphism between the resulting Lie algebras which has the form $(X,z)\mapsto (X,\alpha(X)+z)$ (an "isomorphism of extensions") for a linear map $\alpha:\mathfrak g\to\mathbb C$. This is easily seen to be equivalent to the fact that $\psi(X,Y)=\phi(X,Y)-\alpha([X,Y])$. Guided by that, you observe that $\partial\alpha(X,Y):=-\alpha([X,Y])$ always is a cocycle, and you call cocycles of this form coboundaries. This shows that isomorphism classes of extensions as above are in bijective correspondence with the quotient of cocycles modulo coboundaries, which is the cohomology $H^2$ of $\mathfrak g$ with coefficients in the trivial representation $\mathbb C$. This fits into a much more general picture, since there is cohomology of all degrees and with coefficients in any representation, but that's a different story.
The relation to algebraic topology is most easily seen in the language of de-Rham cohomology: Skew symmetric multlinear maps from $\mathfrak g$ to $\mathbb C$ correspond to left invariant differential forms on any Lie group with Lie algebra $\mathfrak g$ and the Lie algebra cohomology differential $\partial$ from above is induced by the exterior derivative (which maps left invariant forms to left invariant forms).