The effect is thanks to the physical properties of the pasta - you can bend it a lot before it ultimately snaps. So when it does snap, there's a lot of stress within the spaghetti as it springs ...