A hoop is placed on top of a bottle. On top of the hoop, a bean is gently balanced. In one swift motion, the hoop falls out of the way and the bean falls down into the bottle. But if you hit it the "wrong way," the bean and hoop go flying together
While we don't want to give away any magicians' secrets, it is science! More to the point, it is friction.
The force of contact friction between the surfaces of two objects depends on the force pushing the two surfaces together (called the normal force because it is perpendicular to the surfaces) and the coefficient of friction - stationary (static) and/or moving (kinetic).
Since the coefficient of stationary friction is generally bigger than the coefficient of moving friction, the largest stationary friction force is larger than the moving friction force. That is why it is harder to get an object sliding than it is to keep it going!
When you hit the outside of the ring sideways, the ring is compressed horizontally and pushed vertically. The vertical push increases the contact force with the bean, increasing the amount of stationary friction. With higher friction, the bean stays with the hoop as it moves sideways off the bottle.
But, if you hit the inside of the ring sideways it is stretched horizontally and pulled down vertically. This decreases the contact force with the bean (and the stationary friction), letting inertia keep it steady as the ring slides out from underneath. Without the hoop holding it up, the bean simply falls into the bottle because of gravity.
And if you just flick the bean instead of the hoop, you overcome the stationary friction force holding it in place and cause it to follow a simple trajectory to the ground under gravity.