Why does the temperature of a substance always remain constant during a change of state?
Temperature is a measure of average kinetic energy, or energy of motion of molecules. When heat is added and temperature increases, the particles are absorbing the heat and moving faster.
At a substance's melting point and at its boiling point, the energy being absorbed will begin to break down intermolecular attractions holding the particle in a liquid or in a solid formation. The temperature doesn't change during this time because the heat being absorbed isn't increasing the kinetic energy, it's overcoming attractions. Once the particles are separated their kinetic energies will once again begin to increase so that the temperature will go up again.