Three-dimensional topological insulator in a magnetic field: Chiral side surface states and quantized Hall conductance