BB-8's head (also called the dome) is held on using magnets. Magnets inside the ball attract magnets attached to the underside of the head. This page shows how I made all that.
Here's how BB-8's magnets works. The magnets inside the ball are mount on a pole or tube which is attached to the drive system. While the drive system is in the bottom of the ball, that pole keeps the magnets at the top of the ball, where they can attract the head magnets, keeping the head also at the top of the ball.
To make the internal magnet support for the magnets inside the ball, as shown below, I start by cutting and shaping a piece of steel taken from a paint can. To add rigidity, I hot glued on some plastic sides. Then I hot glued two magnets taken from a very old hard disk drive to it.
I don't know if my logic made sense but the steel is ferromagnetic metal, meaning that magnets are attracted to it. The idea was to have at least some of the magnetic field on the side of the magnets that doesn't interact with the head magnets, at least go through the steel from one magnet to the other instead of extending uselessly out into the air. The magnetic field prefers to go through ferromagnetic steel rather than air. This supposedly makes the magnetic field on the other side be stronger than it would otherwise be. My understanding is that some wrecking yard crane magnets use this principle.
In any case, the steel acted as a fair heat sink so that the heat from the hot glue wouldn't heat the magnets to their currie temperature and weaken the magnets. I'm not sure if it would have been hot enough to do that, but it didn't hurt.
I next made the structure shown below. It consists of a rectangular plastic sheet with two 1/4" nylon bolts (because they weigh less than steel bolts) bolted through at the sides. In the middle is a wooden hub being reused from an older project.
I then added nuts to the tops of the bolts and hot glued the structure I'd made previously to those nuts. That completed what I refer to as the internal support. Next I had to mount it to the drive plate.
I took a second wooden hub from that old project and stuck a brass tube tightly in it. Next I put hot glue on the bottom of the hub and glued it to the top, middle of the BB-8's drive plate.
Finally, I put the internal support, the part with the magnets hot glued to it, on the brass tube by pushing the wooden hub down over the brass tube.
Note that I later added another set of smaller hard disk magnets, along with some disk-shaped magnets in order to increase the magnetic attraction. I didn't want to use more hot glue because I feared that the temperature might get hot enough to reach the magnets' curie temperature and weaken the magnets, so I wrapped it all in duct tape instead.
As shown below, the head is made from an 8" styrofoam hemisphere bought from an art store called Michaels. The rollers used are the balls and support parts from a roll-on deodorant product. The magnets are hard disk drive magnets from a very old hard disk. Since the whole head has to be as lightweight as possible I used balsa wood for the base.
I first put the whole drive system, including the internal support that I show how to make above, into the ball. As shown below, I then sit two hard disk drive magnets on the ball and let them be attracted to the internal support's magnets. I measure the distance between them.
I make another steel piece like the one I did for the internal support above, but using the distance measurements between magnets I'd just taken. Ignore the slot cut down the middle since that was cut for a way of doing it that didn't work out.
I next hot glue the magnets to the steel piece.
For the rollers I get three roll-on deodorants. In the photo below, the cover has been removed from one of them so that you can see the roller at the top of the container. The next trick was to separate the top part with the ball and support from the rest of the jar. Do that however you can since each brand is different. I put my bottle in a plastic bag, took it outside, and smashed the glass bottle with a hammer, including at the plastic support to break the glass there into tiny pieces. Then I carefully removed all the glass.
Below you can see the three resulting rollers. Note that when I press on the ball lightly it rolls easily but when I press on it hard it doesn't roll.
As shown below, I next cut out a piece of balsa wood in a shape that would fit inside the opening of the styrofoam hemisphere, and also cut and drill the other needed holes in it, including some extra holes just to make it more lightweight.
Next I temporarily put some long bolts through the drilled holes and put some nylon nuts on the ends. With the steel piece and magnets sitting in position on the ball, I hot glue the nuts to the steel. Using long bolts makes this easier, but they don't need to be that long so I replace them with shorter bolts, also nylon because they're lightweight.
As shown below, I then gently put the roll-on rollers in their holes. The holes are a snug fit so no extra attachment machanism is needed there.
Next, the finished head support structure is inserted into the styrofoam hemisphere. I use a file (sandpaper will also work) to make it fit, but make sure it's a tight fit so that no additional attachment mechanism is needed.
And finally, you can see me putting the end result on the ball below.
Adjusting BB-8's head magnet spacing
The magnetic attraction needs to be strong enough to keep the head on the ball while the ball is starting to roll, rolling and stopping. But if the attraction is too strong then the motor and wheel traction inside the ball may not be powerful enough to overcome it, making it as if the top of the internal support structure is glued to the top of the ball. So adjusting is needed.
There are three places where adjustments can be made.