When switch is pressed, current flows. Electromagnet will produce a magnetic field causing the armature to be attracted towards it. This will separate the contacts so current stop and armature will move back up. Now the contacts are close so current flows again and it repeats, continuously ringing bell.