why does Roly Poly toy when hit on it head come to its original position
Answers
The black dot is the center of mass. If the center of mass is below the center of curvature of the bottom, then when you tilt the doll the c.o.m. will be displaced relative to the point of contact with the surface such that there is a torque that will attempt to right the doll again.
If you place the whole thing on a slope, the same thing happens, but the point of support moves closer. It should be easy to see how the point where the doll becomes unstable is now a function of the distance d relative to the radius of curvature r.
The toy is typically hollow with a weight inside the bottom hemisphere. The placement of this weight is such that the toy has a center of mass below the center of the hemisphere, so that any tilting raises the center of mass. When such a toy is pushed over, it wobbles for a few moments while it seeks the upright orientation, which has an equilibrium at the minimum gravitational potential energy.