An invariant ensemble of $Ntimes N$ random matrices can be characterised by a joint distribution for eigenvalues $P(lambda_1,cdots,lambda_N)$. The study of the distribution of linear statistics, i.e. of quantities of the form $L=(1/N)sum_if(lambda_i)$ where $f(x)$ is a given function, appears in many physical problems. In the $Ntoinfty$ limit, $L$ scales as $Lsim N^eta$, where the scaling exponent $eta$ depends on the ensemble and the function $f$. Its distribution can be written under the form $P_N(s=N^{-eta},L)simeq A_{beta,N}(s),expbig{-(beta N^2/2),Phi(s)big}$, where $betain{1,,2,,4}$ is the Dyson index. The Coulomb gas technique naturally provides the large deviation function $Phi(s)$, which can be efficiently obtained thanks to a thermodynamic identity introduced earlier. We conjecture the pre-exponential function $A_{beta,N}(s)$. We check our conjecture on several well controlled cases within the Laguerre and the Jacobi ensembles. Then we apply our main result to a situation where the large deviation function has no minimum (and $L$ has infinite moments)~: this arises in the statistical analysis of the Wigner time delay for semi-infinite multichannel disordered wires (Laguerre ensemble). The statistical analysis of the Wigner time delay then crucially depends on the pre-exponential function $A_{beta,N}(s)$, which ensures the decay of the distribution for large argument.