An electric bell works with the help of an electromagnet. It is made up of a coil of wire wound on an iron piece, which acts as an electromagnet. On passing the current, magnetic field is produced by the electromagnet.
The hammer of the bell is attracted towards the electromagnet when the circuit is complete. Further, the circuit breaks after the hammer moves towards the electromagnet. When the circuit breaks, the electromagnet doesn’t attract the hammer. The hammer comes back to its original position due to spring effect. As the hammer comes back to its original position, it touches the metal connector and the circuit is complete again. This cycle continues till the key is kept ON.