In much the same way that graphite (in pencils) sticks to paper. The blackboard surface is uneven which serves to abrade the chalk into powder which then is left lodged in the gaps in the rough surface.
Gravity really has a very trivial influence on particles this small (think dust illuminated by sunlight through a window) and is not enough to dislodge them.