Many cat owners are familiar with the sight of a happy cat flexing its digits one paw at a time in a repeated, back-and- forth motion. In very responsive cats, all that's necessary to start them flexing is a friendly petting; if the cat is in your lap, you may feel its claws digging in, just lightly, in a slow, left-right pattern. Owners soon come to associate this odd-seeming behavior with good feelings on the cat's part. But where does it come from?
In fact, this so-called "kneading" behavior is a holdover from the animal's infancy. Unlike human babies, kittens are born in large litters. Mother cats have multiple nipples from which their kittens feed, but the mother cat does not individually nurse her young. When it finds an available nipple, the kitten itself needs to signal the production of milk from the mother before it can drink.
That's done by the simple motion of the kitten's front paws tugging lightly at the breast. This mild massage acts as a natural triggering device for lactation to begin, and the kitten will keep on "kneading" for the whole time it is being fed.
This kneading motion is the same that can be seen in adult cats' moving their paws when happy. Strictly speaking, what was once feeding behavior for a kitten is re-triggered in the adult cat by sensations of being nurtured. But perhaps it's not going too far afield to say that when a cat flexes its paws, it's demonstrating a kind of feline recollection of those happy childhood days.