At the end of Section 14.1 in Pressley, Segal "Loop Groups" there is the remark that 
the partition function is a modular function in the sense that the Dedekind $\eta$ function is a modular form. I am interested about the following remark:



> 
> It follows from the Kac character formula that the characters of all positive energy 
>  representations of loop groups are constructed from modular functions in an appropriate 
>  sense. No explanation of this phenomenon seems to be known at present.
> 
> 
> 


So my question is basically what is the present knowledge about this "phenomenon"? 



What is known about the connection of positive energy representations of loop groups and modular forms
That the characters of representations have modular properties is the content of Kac-Peterson [1]. As for an "explanation" of this, there are several but I'm afraid all of the ones I know involve in one way or the other physics. In his seminal paper [2] Zhu proves modularity for Vertex Operator Algebras with certain conditions. This explains in particular the statement in your question (at the affine Lie algebra level). However, Zhu came to his result by studying the correlation functions of these algebras on the torus, so I'll try to expand minimally on the topic although you'll find a beautiful exposition in Frenkel-Ben-Zvi's book [3]. 


The idea is as follows, to each vertex operator algebra $V$ (the one associated to an affine Kac-Moody Lie algebra in the case of your question) and an algebraic curve $X$ you can associate a vector space of coinvariants of $V$, $C(X,V)$. As the curve $X$ moves in the moduli space of curves of a given genus, the vector spaces $C(X,V)$ arrange to form a vector bundle on this space (it is generally a quasi-coherent sheaf, but under certain finiteness condition which holds in your case it is a bundle). This can be generalized by looking at pointed curves and modules of $V$ over the marked points of $X$. In the particular case that you look at the moduli space of elliptic curves, the sections of this bundle are the characters of the representations (where $q = e^{2 \pi i \tau}$ is the modular parameter of the corresponding curve). This is a "reason" for those characters to have modular properties, however, the fact that we expected already these spaces to form a bundle on $M\_g$ comes from CFTs considerations. 


[1] Kac, Victor G.(1-MIT); Peterson, Dale H.(1-MI) Infinite-dimensional Lie algebras, theta functions and modular forms. Adv. in Math. 53 (1984), no. 2, 125–264.  

[2] Zhu, Yongchang(HK-HKST) Modular invariance of characters of vertex operator algebras. J. Amer. Math. Soc. 9 (1996), no. 1, 237–302.  

[3] Frenkel, Edward; Ben-Zvi, David Vertex algebras and algebraic curves. (English summary) Mathematical Surveys and Monographs, 88. American Mathematical Society, Providence, RI, 2001. xii+348 pp. ISBN: 0-8218-2894-0 


