Electric current flows through the coil when the switch is ON, and the iron core acts as an electromagnet.
 The iron core attracts the hammer towards it.
 The hammer hits the bell and produces a sound. The circuit breaks at the screw contact when the hammer moves towards the iron core. At this point, the iron core ceases to be an electromagnet.
The hammer is pulled back to its original position due to the spring action of the steel rod, and then touches the contact again to complete the circuit.
 The circuit is completed and current flows through the coil again, and the hammer strikes the bell again.
The process repeats itself and you hear a ringing sound since the hammer keeps hitting the bell, until the switch is released.