This experiment works due to the corners of the nut vibrating the balloon. The faster the vibrations, the higher the pitch. It also demonstrates rotational inertia, whereby an object with sufficient momentum will tend to speed around the outside of a circle due to the centrifugal motion of the spinning circle... i.e. the nut tries to escape out of the balloon in a straight line but the balloon's shape forces it to travel around in a circle.
Easy and fun science!