Mechanisms of pattern formation and smoothing induced by ion-beam erosion