Magnetic field lines opposite to actual direction I was reading about purely inductive AC circuits.
This is how the book tries to explain what happens in each cycle.

As it can be seen, in the first and the fourth scenarios ,some magnetic field lines enter from the north and exit from the south.I don't understand why this is so.
Can anybody provide me with a simpler explanation of the mechanism described over here?How does p (power) being positive or negative tell me if energy is being absorbed or given back?
Also why is there an iron rod (or whatever material it is made up of) inside the inductor ?What if I don't have this rod? Will the inductor not work?
 A: If U and I are in antiphase, the system oscillates. This oscillation contains energy (which you previously put in). To arrive in an "in-phase"-state, it will dissipate the surplus of energy you previously put in.
A mechanical analogy: You have two masses connected via a spring. Now you take one mass and push the object really fast to accelerate it forward. It will now both fly forward, and oscillate. During the oscillation, when it swings outwards, it decreases potential energy, until it's halfway done with the oscillation (aka passes the equilibrium point). From that point on, it again increases its potential energy. This increase and decrease of potential energy is observable in your example too. Whenever the oscillation loses potential energy, it will transfer it to the source, by accelerating the mass (or in your case electrons).
If you had pushed the object very carefully, it would not have started swinging. That would be the DC equivalent.
The magnetic field lines go in the same direction as the current, but they can go opposite to the voltage, because the current can do so.
A: 
As it can be seen, in the first and the fourth scenarios ,some
  magnetic field lines enter from the north and exit from the south.I
  don't understand why this is so.

The magnetic field direction in the coil is determined by the direction of the current passing through the coil.

Can anybody provide me with a simpler explanation of the mechanism
  described over here?How does p (power) being positive or negative tell
  me if energy is being absorbed or given back?

Energy is required to produce a magnetic field.  When the magnetic field is increasing energy needs to be supplied to the inductor and this comes from the source.
When the magnetic field is decreasing the inductor gives back to the source the energy that it obtained when the magnetic field was increasing.
The convention which is used here is that power given to the inductor by the source is positive and power the inductor gives to the source is negative.

Also why is there an iron rod (or whatever material it is made up of)
  inside the inductor ?What if I don't have this rod? Will the inductor
  not work?

The iron is a ferromagnetic material and hence increases the strength of the magnetic field and so the size of the inductance of the coil.  Without the iron the inductance is much lower and for a given current less energy can be stored in the inductor.
A: Some remarks in addition to Farcher's answer.

... some magnetic field lines enter from the north and exit from the south.I don't understand why this is so?

Talking about a magnetic field one has to remember that magnetic field lines are closed circuits. Placing a probe magnet with marked north and south pole (purely a convention, but a convention all over the world luckily) on one end of the coil this magnet shows the pole of the electromagnet. By this it was proved that depending from the direction of the coil winding and the direction of the electron flow the magnetic field get induced in each case and under all circumstances by the same way. This has to do with the one to one correlation between the electron's magnetic dipole moment and the intrinsic spin.

Can anybody provide me with a simpler explanation of the mechanism described over here?

The shortest possible answer is that the moving electrons get accelerated due to their spiral path and by this their magnetic dipole moments get aligned (gyroscopic effect). This is what in sum produces the magnetic field of the coil. We call this induction of a magnetic field by accelerated electrons. 

Can anybody provide me with a simpler explanation of the mechanism ... if energy is being absorbed or given back.

The alignment of the electrons in the coil require energy. This energy comes from the kinetic energy of the electrons, they flow slower (the resistance of the coil rises). At some moment there is an equilibration between the induced magnetic field and the electric current (the flow rate of the electrons). Switching off the current, the magnetic dipole moments of the involved electrons fall back in their initial state and the magnetic field decreases. (Furthermore there are swing out processes, don't care about them at the moment). The induced by the electrons magnetic field of the coil give the stored energy back to the electrons. The coil's magnetic field works like a spring.
