Why a coil shape basically, why not some other shape, why is a coil more advantageous?
The magnetic field generated by a current is perpendicular to the wire. If the wire is straight, you’ll have some intensity of the field at a given point in space. If you coil the wire around the same point, though, the same wire will generate a much stronger field at that point, because the field generated by each tiny piece of wire will overlap.
the best shape for generating a magnetic field is a closed loop actually. A coil; especially one where the turns are close together as possible is essentially a stack of identical loops all generating a magnetic field of the same direction in the same region with the same current. increasing the amount of space between each turn on a fixed number of turns will actually reduce the strength of the magnetic field generated
One wire creates a weak field. The next wire adds to it, and the next wire adds more, and so on. In a loop, both sides of the loop add together in the middle of that loop, while on the outsides they are competing.
A stack of loops, a coil, creates a strong field inside.
The movement of charge creates a magnetic field. Current (like in a wire) is just moving charge.
The magnetic field forms loops around the wire. By making a coil, every loop of wire adds its magnetic field together inside the coil.
Every loop you add is another set of magnetic fields being added to the coil.
Any other stack of the same shapes will produce the same effect as long as you don’t change the direction the current goes around, but a circle has the benefit of the magnetic field will be uniform everywhere inside the coil.