As far as I understand, the mechanism for the long-term average change of Earth's rotation period is the following: Tidal forces cause the Earth's crust and oceans to bulge towards the Moon (and symmetrically away from it on the other side of the Earth). Because of the inertia of Earth's crust (from finite speed of sound in the Earth's crust/water), the bulge does not point exactly towards the Moon, but is slightly on the side of the direction where Earth rotates to. Because the bulge is closer to the Moon, it experiences larger gravitational pull towards it, and similarly the opposite bulge has smaller pull. The net effect is that there is a torque that tends to slow Earth's rotation. Because the energy of Earth-Moon system is approximately conserved, it also means that as Earth's kinetic rotational energy diminishes, the potential energy of Earth-Moon system must increase to compensate. Therefore the Moon slowly drifts to higher potential energy, meaning that its distance from the Earth increases.
The short term changes in the rotational period cannot be explained by the above mechanics alone because the Earth-Moon system is actually in details more complicated (atmosphere sloshing around, more complex ocean tidal patterns, Earth's internal mass flows etc.)