The electromagnet is powered 'on' by the battery as long as the door and window contacts are closed. This pulls up the pivot bar against the power of the stretched spring.
If a door or window contact opens, the electromagnet is switched off, and the spring pulls the pivot bar down. The bar presses against the bell switch contacts and closes them.This completes the bell circuit and allows the bell to ring.
The diagram is not clear, but it looks as though a second battery should be present in the bell part of the circuit.