BB8's head will stay ontop of his ball body by driving around on it with 4 wheels.
The frame is composed of 2 spheres one inside the other. This leaves a cavity in the shell 7.5 cm wide for gadgets and leaves the inner shell for the rolling drive system. For flight mode the droid will have to roll into the correct orientation where there will be magnets for the head to lock onto the droid body, as well as high current contact on the inner sphere to carry power to the flight motors from the battery which is used as ballast in the drive system. The orange circle will slide or hinge out of the way enough to allow the motors to swing out of the body and then close with a second tinier hinged section left open for the motor arm.