Analytic treatment of the black-hole bomb