Note, that here, the ˆLn are operators on the state given by the sums of the dots of the mode operators, i.e. ˆL0=∑∞k=−∞ˆα−n⋅ˆαn.
Also note that The Virasoro Algebra is the central extension of the Witt/Conformal Algebra so that explains why we have a D, it is equivalent to the central charge.
I'll expand on Chris Gerig's answer.
Not only do we need D=26, we also need the normal ordering constant a=1. The normal ordering constant is the eigenvalue of ˆL0 with the eigenvector the state.
We want to promote the time-like states to spurious, zero-norm states, right? So, we impose the (level 1) spurious state conditions on the state as ffollows (|χ⟩ are the basis vectors to build the spurious state Φ⟩ on.)$:
0=ˆL1|Φ⟩ =ˆL1ˆL−1|χ1⟩ =[ˆL−1,ˆL1]|χ1⟩+ˆL−1ˆL1|χ1⟩ =[ˆL−1,ˆL1]|χ1⟩ =2ˆL0|χ1⟩ =2c0(a−1)|χ1⟩
That means that a=1.
Now, for a level 2 spurious state,
[ˆL1,ˆL−2+kˆL−1ˆL−1]|ψ⟩=(3ˆL−1+2kˆL0ˆL−1+2kˆL−1ˆL0)|ψ⟩ =(3−2k)ˆL−1+4kˆL0ˆL−1 (3−2k)ˆL−1+4kˆL0ˆL−1 0=ˆL1|ψ⟩=ˆL1(ˆL−2+kˆL−1ˆL−1)|χ1⟩=((3−2k)ˆL−1+4kˆL0ˆL−1)|χ1⟩ =((3−2k)ˆL−1+4kˆL−1(ˆL0+1))|χ1⟩ =(3−2k)ˆL−1|χ1⟩2k=3k=32
Since this level 2 spurious state can be written as:
|Φ⟩=ˆL−2|χ1⟩+kˆL−1ˆL−1|χ2⟩
So, then,
ˆL2|Φ⟩=0ˆL2(ˆL−2+32ˆL−1ˆL−1)|χ2⟩=0[ˆL2,ˆL−2+32ˆL−1ˆL−1]|χ2⟩+(ˆL−2+32ˆL−1ˆL−1)ˆL2|χ2⟩=0[ˆL2,ˆL−2+32ˆL−1ˆL−1]|χ2⟩=0(13ˆL0+9ˆL−1ˆL−1+D2)|χ2⟩=0D2=13D=26
Q.E.D.
So, this was done essentially to remove the imaginary norm ghost states and using the Canonical / Gupta - Bleuer formalism.
It's also possible to use , say, e.g. Light Cone Gauge (LCG) quantisation. However, in other quantisation methods, the conformal anomaly is manifest in other forms. E.g., in LCG quantisationn, it is manifest as a failure of lorentz symmetry. A good overview of this method can be found in Kaku Strings, Conformal fields, and M-theory.