What are the most general conditions on a Lie algebra $\mathfrak{g}$ over a field $\mathbb{k}$ such that the space of invariant symmetric bilinear forms is isomorphic to $H^3(\mathfrak{g},\mathbb{k})$?


The isomorphism should look like this: $\langle \cdot,\cdot \rangle \to \langle \cdot, [\cdot,\cdot]\rangle$ and I've managed to prove the statement for $\mathfrak{g}$ semisimple compact, but since the question is purely algebraic I don't think the "correct" proof should involve integrals over $G$. ;-)



invariant symmetric bilinear forms and Lie algebra cohomology
The map $\langle\cdot,\cdot\rangle\mapsto\langle\cdot,[\cdot,\cdot]\rangle$ is usually called *Koszul homomorphism*. Indeed Koszul showed that for a semisimple Lie algebra over a field of characteristic zero it is an isomorphism.


For an arbitrary Lie algebra (say over a field of characteristic zero), it always maps into the space of closed 3-forms $Z^3(\mathfrak{g})$, and thus defines by composition a natural homomorphism from the space $\mathrm{Sym}^2(\mathfrak{g})^\mathfrak{g}$ of invariant symmetric bilinear forms to the 3-cohomology space $H^3(\mathfrak{g})$ (let's call it "reduced Koszul homomorphism"), and there is an exact sequence in which the reduced Koszul homomorphism fits, see [Neeb-Wagemann's](http://arxiv.org/abs/math/0511260) appendix. In particular, if $H^1(\mathfrak{g},\mathfrak{g}^\*)=H^2(\mathfrak{g},\mathfrak{g}^\*)=0$ then the reduced Koszul homomorphism is an isomorphism (I don't have in mind any example for which this holds other than the semisimple ones). 


It is not an isomorphism in general (neither injective nor surjective), for instance for an abelian Lie algebra it is the zero map; Magnin actually checked ([see here](http://inmabb.criba.edu.ar/revuma/pdf/v53n2/v53n2a05.pdf)) that the Koszul homomorphism is zero for every nilpotent Lie algebra up to dimension 7. Magnin also checks that the Koszul homomorphism itself is zero in many cases (this means that the invariant symmetric bilinear forms are only the obvious ones: those symmetric bilinear forms whose kernel contains $[\mathfrak{g},\mathfrak{g}]$).


This concerns specifically this natural map; in general I don't think there is much to say: to say that the vector spaces $\mathrm{Sym}^2(\mathfrak{g})^\mathfrak{g}$ and $H^3(\mathfrak{g})$ are isomorphic just means that they have the same dimension.


