Averages of characteristic polynomials in random matrix theory