it is thought by anthropologists that witches used to 'apply' their flying ointments with them, in much the same way as one would 'ride' a broomstick. the flying ointment was a hallicinogen made for belladonna that could be absorbed through a thin area of skin.
various answers, including phallic symbolism, the application of hallucinogens to vaginal tissue via a stick, the use of staves in rituals which would be disguised as brooms to keep witchfinder generals at bay, and so on. I don't think any of these is universally accepted as correct, they're just hypotheses.