The illustration on the left is an oblique view, and the one on the right is from the front. We have removed bits of the anatomy in each to make things simple to visualise. As the joint bends, the patella makes contact in the deeper part of the groove between the rounded ends of the femur, and as the joint is straightened it makes contact in the shallower part of the groove above the rounded ends.

What is easy to appreciate is that a good deep groove and a congruent shape under the patella would help to maintain this relationship. Were the groove to be abnormal, or the underside of the patella, then stability might not be so good as the knee bends and straightens.
In some people - sometimes in only one knee and sometimes in both knees - the groove is not normal. It may be shallow - even flat - or concave rather than convex, and in extreme cases the one side may look like a ‘bump’ while the other side is under-developed and resembles a ‘cliff edge’. In each of these, corresponding structural anomalies may also be evident on the undersurface of the kneecap. This is called 'trochlear dysplasia'.
The 'bump' is situated at the upper end of the groove and may not be visible during arthroscopy unless the instruments and 'keyholes' are changed to allow the surgeon to view from above, like in this ilustration on the left.

With such a bump (illustration on right) the kneecap has no groove to contain it, and it may be unstable, and sublux (pop over to one side) or even dislocate (jump right out the groove). This is referred to as 'patellofemoral' instability.
In other cases the groove may simply be too flat, and instability may also occur just because the walls of the groove cannot contain the patella properly.