When you run electricity through a conductor, a magnetic field is created. As soon as you combine multiple magnetic fields, forces can arise. By playing smart with those forces you get to the base of the electric motor. Conversely, you can also use a magnet to pass a current through an electrical conductor. When you generate a current in a conductor using an electromagnet, you come to the base of the transformer. That sounds complicated, but is it?
As soon as you pass a current through an electrical conductor (for example a copper wire), a magnetic field is created around that conductor. Depending on the direction in which the current flows, the magnetic field will rotate one way or another around the conductor.
Now imagine a situation where you keep the current conductor with its round magnetic field in the magnetic field between two permanent magnets (a north and a south pole). The magnetic field around the current conductor and the field of the permanent magnets will now respond to each other. On one side of the current conductor, the fields will reinforce each other and weaken on the other side of the conductor. This creates a force on the current conductor, the Lorentz force, which wants to push the current conductor aside. If you now place a second current conductor above the current conductor and let the current flow through the second conductor in the other direction, a Lorentz force will act on the second conductor in the opposite direction to that of the Lorentz force of the first conductor. Now imagine a situation where we connect the two conductors together with one arm and place a pivot halfway along that arm. Because the Lorentz forces of the two current conductors both move around the pivot point, but are opposite to each other, a torque will arise around that pivot point. The result is that the arm with a current conductor on either side will make a rotating movement. See here: the basis of the electric motor.
Instead of creating a magnetic field by sending a current through a conductor, you can also do it the other way around and generate a current by holding a magnet near a conductor. And when you wind up that conductor into a coil, you can add the voltage generated in each of those turns, or the more turns the higher the voltage. Now suppose that the magnetic field that you hold at the coil does not come from a permanent magnet, but from an electromagnet in the form of a coil (the primary coil), then you can transfer a current from that primary coil to the other coil ( the secondary coil). When there is a difference in the number of turns of the primary and secondary coil, there will be a proportional difference in voltage across the coils. If there is a voltage of 12 volts across a primary coil and the secondary coil has ten times as many turns, then there will be a voltage of 120 volts across that secondary coil. See here: the base of the transformer and therefore the ignition coil which, as part of the ignition, must ensure such a high voltage that the spark plug can spark.