The partition function Z_N in unitary invariant ensembles of N x N random matrices is a very important object in mathematical physics, and its asymptotic behaviour as N tends to infinity has been studied for a long time in different settings. In this talk we will present some general results for ensembles with polynomial potentials, and show how in some cases the asymptotic behaviour of Z_N can be obtained using tools from orthogonal polynomials and integrable systems.