It's called kneading...
You know you've experienced that wonderful yet painful sensation of a cat kneading on your lap, digging his claws unknowingly into your flesh. Yes, it hurts. But it's an honor that your cat feels comfortable enough to let you share in that special moment of contentment! If you want to properly care for your cat, you need to know what it means when your cat does this.
Kneading is when a cat flexes and relaxes his front paws over and over again for several minutes. If your cat kneads his claws on YOU frequently, that should be an incentive for you to keep his claws trimmed. Or you can just make sure to put a thick blanket on your lap before he begins. (I still recommend keeping his claws trimmed, though. Visit the page on Grooming for tips and a video on that.)
According to "Why Do Cats Do That? Real Answers to the Curious Things Cats Do," kneading is a behavior that develops at birth that helps kittens obtain milk from their mother. They push on their mother's soft underside to make the milk flow better. But once a cat is grown, he will still likely perform the kneading process. At that point, it's safe to say that it happens when a cat is extremely content and relaxed, as if he is remembering his happy childhood...well, kittenhood.
Below, you can view a YouTube video of a cat kneading. As you can see, this cat has decided to knead his paws on a dog (of all things to choose from!) I guess this goes against the stereotypical view that cats and dogs don't get along. Both the dog and the cat in this video look pretty content to me! So, then, let it be known that cats will knead on just about anything that is soft, including a blanket, piece of furniture, a dog or your lap. No matter what location the cat chooses, you can bet he is happy!
The book explains that the phrase "making biscuits" exists simply because when cats knead, it indeed looks as if they are kneading dough to make biscuits. Cats often will purr at the same time as kneading (and even drool in some cases!)
Female cats in heat will knead as well, but kneading does not necessarily mean a cat is ready to mate.