How does magnetic effect works? Let’s start with an experiment, you can do this at home with things you can find around you. You will need:
Step1: grab the insulated wire, strip off the insulation around 1cm on each side.
Step2: connect one end of the wire to the positive terminal of the battery, use the electrical tape if necessary.
Step3: place a strong neodymium magnet under the wire, do not connect the wire and note down your observations.
Step4: now connect the free end of the wire to the negative terminal and see what happens, note down your observations.
Step5: now keep the wire as it is and interchange the terminals of the battery, notice what happens. Note down your observations.
Inference: we can see that the wire bends when there is current flowing through it, and when the polarities are inverted the wire bends in the opposite direction.
This is because current flowing through a conductor induces a magnetic field around the conductor, this can be easily understood by the right-hand rule, which states that if you make a thumbs up sign with your right hand then the thumb pointing in the direction of the current and rest of your fingers indicate the direction of the magnetic field.
When you apply current to the conductor it will produce a magnetic effect or field around it, so basically the wire acts like a magnet, and it will interact with the permanent magnet you have placed next to it, this effect can be reversed by changing the direction of the current, which according to the rule changes the direction of magnetic field produced by it.
We know that in magnets like poles repel and unlike poles attract each other, so depending on the direction of the magnetic field induced, the conductor will either get attracted or get repelled by the permanent magnet.