In-universe, how is BB-8's head adhered to his body?
As commenters have noted below the question, the obvious answer is magnets, but it was surprisingly hard to find an official confirmation of this.
The most common in-universe schematic of BB-8 that seems to be going around is the one directly below, which comes from a licensed card set. It unfortunately does not highlight the components or mechanism responsible for keeping the head attached to the body:
Branching out, I found this licensed cushion that is available, for example, at StarWarsBedroom.com:
The sketch on the cushion has an arrow labelled magnetic balancing, pointing at where the head sits on the body.