Why is there a Cardy formula in 2D CFT? In 2d CFTs, we have the Cardy formula which tells us the number of states, which can be derived from the partition function by using modular invariance. What special property of 2D CFTs make it possible to derive such formula?
 A: This question was just bumped to the homepage, so let me try to give a physical answer to explain why modular invariance is particular to two dimensions. The Cardy formula tells you something about the density of states of a CFT. In order to count the states of a CFT in $d$ dimensions, you naturally consider the thermal partition function $Z_{S^{d-1}}(\beta,R)$ on a sphere $S^{d-1}$, where the sphere has radius $R$. "Thermal" means that we are working in Euclidean time, compactified on a circle of length $\beta$. The Hamiltonian in the thermal direction is the generator of dilatations $D$, so
$$
Z(\beta,R) = \sum_{\text{all states}} e^{-(\beta/R) \Delta}.
$$
In the limit $\beta/R \ll 1$ there is barely any exponential suppression, so the sum is sensitive to all states, and you can extract thermodynamical information about the CFT. In the opposite limit $\beta/R \gg 1$ only a few terms contribute significantly.
In $d=2$ something special happens. "Space" $S^{d-1}$ is a circle $S^1$ of length $L = 2\pi R$. So the whole manifold is just a rectangle (or to be precise a torus, since we have periodic boundary conditions). Nothing happens if you swap $L$ and $\beta$, so we get an identity
$$
Z(\beta,L) = Z(L,\beta).
$$
Since the theory is scale invariant we can rescale and drop the second argument, which gives
$$
Z(\delta) = Z(\delta^{-1}), 
\quad \delta = \beta/L.
$$
This means that you can say something about a difficult thermodynamic limit $\delta \ll 1$ from a trivial limit $\delta \gg 1$, and this leads to identities like Cardy's formula. The crucial ingredient was that there is a symmetry between the spatial $S^1$ and the thermal $S^1$ in 2d, whereas in higher d we cannot swap $S^{d-1}$ and $S^1$.
I have glossed over some technical details, especially in neglecting the so-called Weyl anomaly. However, the above logic should explain what is special about $d=2$.
A: Firstly, it should be pointed out that there exist Cardy formulae for other dimensional CFT's too. See https://arxiv.org/abs/1407.6061 by Komargodski and Di Pietro and this paper by Verlinde https://arxiv.org/abs/hep-th/0008140. 
But let us come to your question in 1+1 dimensional theories. The primary principle is that for unitary conformal field theories, the conserved charges which label the states (i.e momentum and energy) are both functions of the $L_0$ and $\bar{L}_0$ generators and only. So the total density of states will depend up to leading order on $L_0$ and $\bar{L}_0$, from the principles of statistical mechanics. The final form of the partition function then can then be derived by demanding modular invariance i.e. the number of states should not depend on the way you parametrize the lattice on which the theory lives. 
Edit: One thing I want to add (which may not directly contribute to the answer) is that the Cardy formula is valid for unitary theories in 2d CFT's at large central charge. Usually, it is not too difficult to obtain contraints on unitary representations of a CFT in terms of the conformal weight and central charge and in principle, you can find unitary field theories at large central charge. In other dimensions, contraints on unitarity can be more strict owing to the presence of more than one central charge, as in the case of 4d CFT's. This is the fundamental difference between Cardy formulae in 2d and other dimensions i.e. contraints on unitarity. If you look at how one would count states in 4d CFT's for example, you will see that they depend on the difference between the two central charges $(c-a)$. 
