My cheap kettle leaked.  You couldn't press the lever down when it wasn't on the base, so I hoped to find an electromagnet which held the switch on when it had power.  I didn't find one (I only managed to salvage two neon lights from it), but I found out how kettles switch off when they're boiling.

The steam is collected by this hood, which sends it down the tube into the base.

The steam then enters the base of the kettle through the hole at the bottom of this picture, where it's deflected onto this disk.

The disk flexed when I pressed in the middle.  The part that sticks out pressed against the lever that switches the kettle on and off.  I guess that as the disk heats and expands, it flexes in the same way.

The lever that operates the kettle is like a large microswitch, in that it always snaps to one side or the other, and takes little force to change.  The disk flexes and presses lightly on the lever, but it's enough force to trip the switch so the kettle turns off.

I didn't find the electromagnet I was looking for.  Instead, whether the lever stays down depends on whether the kettle is sitting on its base.  If not, a pin with a strong spring on it protrudes from the bottom of the kettle.  The spring prevents the lever from staying down.