If I remember right, the shifter is splined, and is 'male', and the shift knob is splined and 'female'. The splines just grip each other, I think.
Mine first came off during a "panic shift" whike offroading. I went to drop it into second in a white-knuckle situation, and adrenaline helped pull the knob right off!