How an Electromagnet Works and Why a Shoemaker Invented it