Place the jar over the ball so that the ball is inside the mouth of the canning jar. Then start spinning the glass around in a circular motion.
Once the ball starts spinning inside the glass lift it from the table top.
The ball is lifted from the table and will continue to spin inside the glass until it loses is speed.
As a ball velocity increases inside the glass, the centripetal force increases. That force is what’s keeping the ball stuck to the walls of the glass.
As the ball goes faster, the resulting friction begins to cancel out the force of gravity acting on the ball. The centripetal force and friction, and those factors rely on velocity. If the ball goes too slowly, the velocity won’t increase enough to out-do the force of gravity, and the ball will fall out of the glass.