Why it happens
Pasta releases starch into the water as it cooks, and the surface of each piece becomes sticky. If the pan is too small or the water not boiling when the pasta goes in, pieces sit together and fuse as the starch sets. Not stirring early on lets them stick together. Leaving drained pasta to sit without any sauce or liquid lets the starch dry and glue it into a clump.