Relation between cohomology and the BRST operator Given a manifold $M$, we may define the $p$th de Rham cohomology group $H^p(M)$ as the quotient,
$$C^p(M) \, / \, Z^p(M)$$
where $C^p$ and $Z^p$ are the groups of closed and exact $p$-forms respectively. Now consider symmetry operators $K_i$ which form a closed Lie algebra, $G$, i.e.
$$[K_i,K_j] = f_{ij}^k K_k$$
with $f_{ij}^k$ the structure constants. We introduce anti-ghosts $b_i$ which transform in the adjoint representation of $G$, and ghosts $c_i$ transforming under the dual adjoint representation obeying canonical commutation relations. In Witten's Superstring Theory, they define an operator,
$$Q=c^i K_i -\frac{1}{2}f_{ij}^k c^{i}c^{j}b_{k}$$
known as the BRST operator, and they explicitly state,

To mathematicians it is the operator that computes the cohomology of
  the Lie algebra $G$, with values in the representation defined by the
  $K_i$.

I am familiar with the interpretation of compact semi-simple Lie groups as manifolds, and can understand how they may have a cohomology. However, it is not obvious from the expression for $Q$ the relation to cohomology, or differential geometry at all. Can someone elucidate and/or prove the relation, as well as how one obtains $H^p(M)$ knowing $Q$? Recommended resources on BRST quantization, and in particular from the lense of differential geometry are appreciated also.

It is clear that assuming $Q$ is the aforementioned, that the equivalence classes of states which differ by $Q\lambda$, for some state $\lambda$, are cohomology classes. But how do we establish what $Q$ is in the first place, and obtain $H^p$ in the BRST formalism?
In addition, if we are given the cohomology classes, $H^p$ for a field theory, what physical implications do they have regarding the system?
 A: Ghostly Lie algebra cohomology
Let $\mathfrak{g}$ be our Lie algebra and $V_\rho$ a representation space with representation map $\rho : \mathfrak{g} \to \mathrm{End}(V_\rho)$. $V_\rho$ is, by the action through the representation, naturally a $\mathfrak{g}$-module (people missing the ring structure in $\mathfrak{g}$ - just embed it into the universal enveloping algebra). We define the associated Chevally-Eilenberg complex as the complex of $V_\rho$-valued differential forms on $\mathfrak{g}$:
$$ \dots \overset{\mathrm{d}}{\to} \Lambda^{p-1}\mathfrak{g}^* \otimes V_\rho \overset{\mathrm{d}}{\to} \Lambda^{p}\mathfrak{g}^* \otimes V_\rho\overset{\mathrm{d}}{\to} \Lambda^{p+1}\mathfrak{g}^* \otimes V_\rho\overset{\mathrm{d}}{\to}$$
whose cohomology we call the Lie algebra cohomology of $\mathfrak{g}$ with coefficients in $V_\rho$. Now, the algebraist is disturbed: There's an ugly differential in our complex, spoiling the fun! Let's build an operator expression for it:
Recall that, on $\Lambda^p \mathfrak{g}^*$, we have two natural operations:
Contraction, which is
$$\iota : \Lambda^1 \mathfrak{g}^* \times \mathfrak{g} \to \Lambda^0 \mathfrak{g}^*, (\omega,G) \mapsto \omega(G)$$
extended to all $\Lambda^p\mathfrak{g}^\ast$ by setting $\iota(\omega \wedge \xi,G) = (\omega\wedge\xi)(G) \wedge (-1)^{\mathrm{deg}(\omega)}\omega\wedge(\xi(G))$ and the wedge product, which is
$$\wedge : \Lambda^p \mathfrak{g}^* \times \mathfrak{g}^* \to \Lambda^{p+1} \mathfrak{g}^*, (\omega,k)\mapsto k\wedge\omega $$
and these define two operators $\iota_G = \iota(-,G)$ and $\wedge_k = k \wedge -$ acting upon $p$-forms.
Now, choose any canonically dual basis of $\mathfrak{g}$ resp. $\mathfrak{g}^*$, let's call them $T_a$ resp. $S^a$, and write
$$ \mathrm{d} = \wedge_{S^a}\rho(T_a) - \frac{1}{2}\wedge_{S^a}\wedge_{S^b}\iota_{[T_a,T_b]}$$
Using it on the basis elements of $\Lambda^{p}\mathfrak{g}^* \otimes V_\rho$, we can show by direct computation that this is indeed the differential from the Chevalley-Eilenberg complex, and thus an operator expression for the differential. Defining $c^a := \wedge_{S^a}$ as the ghost and $b_a := \iota_{T_a}$ as the anti-ghost yields that the Chevalley-Eilenberg differential is indeed the BRST operator
$$ Q = \mathrm{d} = c^a\rho(T_a) - \frac{1}{2}f^c_{ab} c^a c^b b_c $$
What does $Q$ compute in physics?
Classically, we apply this approach to symplectic manifolds/phase spaces $\mathcal{M}$ that possess a (symplectomorphic) group action by a Lie group $G$, and we construct the equivariant moment map
$$ \mu : \mathcal{M} \to \mathfrak{g}^*$$
defined by being equivariant under the coadjoint action of $G$ on $\mathfrak{g}^*$ and fulfilling $\mathrm{d}(\mu(\dot{})(g)) = \omega(\rho(g),\dot{})$ with $\omega$ as the symplectic form. If the action of $G$ represents a gauge symmetry, we would like to obtain the coisotropic reduction $\tilde{\mathcal{M}} := \mathcal{M}/ G$ containing no redundancies. Define the submanifold $M_0 := \mu^{-1}(0)$ and observe that the poisson algebra of functions on $\tilde{\mathcal{M}}$ fulfills
$$ C^\infty(\tilde{\mathcal{M}}) = H^0(\mathfrak{g};C^\infty(M_0))$$
since the zeroth cohomology of a Lie algebra with coefficients in a module consists of precisely the elements of the module that are invariant under the group action and because the natural projection $\pi : \mathcal{M}_0 \to \tilde{\mathcal{M}}$ provides a pullback from functions on the reduction to $\mathcal{M}_0$. We don't want to rehash the derivation of the Koszul complex here, suffice it to say that $H^0(\mathfrak{g};C^\infty(M_0))$ can be computed by looking at the complex
$$ \dots \to \Lambda^2 \mathfrak{g} \otimes C^\infty(\mathcal{M}) \to \Lambda \mathfrak{g} \otimes C^\infty(\mathcal{M}) \to C^\infty(\mathcal{M}) \to 0$$
and computing $H^0 = C^\infty(\mathcal{M}_0)$ and $H^p = 0$ otherwise, leading to the projective resolution
$$ \dots \to \Lambda^2 \mathfrak{g} \otimes C^\infty(\mathcal{M}) \to \Lambda \mathfrak{g} \otimes C^\infty(\mathcal{M}) \to C^\infty(\mathcal{M}) \to C^\infty(\mathcal{M}_0) \to 0 $$
yielding, since the tensor product is left exact, a projective resolution for $\Lambda^p \mathfrak{g}^* \otimes C^\infty(\mathcal{M}_0)$
This yields a bicomplex $C^{p,q} := \Lambda^p \mathfrak{g}^* \otimes \Lambda^q \mathfrak{g} \otimes C^\infty(\mathcal{M})$, from which a usual graded complex $\mathcal{C}^p$ may be constructed by $\mathcal{C}^p := \bigoplus_{r + s = p}C^{r,s}$, which is the infamous BRST complex, and which can be written as $\mathcal{C}^p = \Lambda^p(\mathfrak{g} \oplus \mathfrak{g}^*) \otimes C^\infty(\mathcal{M})$
With some algebraic magic involving the Poisson superalgebra structure of this complex, one can retrace the steps for deriving an explicit from for the differential from the ghostly cohomology for Lie algebras, and obtain that, here,
$$ \mathrm{d} = \{Q,\dot{}\}$$
with $Q \in \mathcal{C}^1$ being the classical BRST operator, and this time the ghosts and antighosts are the images of the generators of $\mathfrak{g}$ and $\mathfrak{g}^*$ under the natural embedding of these into $\Lambda(\mathfrak{g} \oplus \mathfrak{g}^*$).

A lengthier, but still quick and very readable discussion of this can be found in Josê Figueroa-O'Farrill's lecture notes on "BRST Cohomology".
