Cats, and all other pets for that matter, manage to communicate with their humans via body language. Once you manage to decipher it, you'll know the reason behind the mysterious behavior of your cat.
Kneading is an inherited behavior formed in kittenhood. Kittens knead the mother's teat to stimulate milk flow. This action of kittens is called 'milk thread' as this is carried out during nursing. When the kitten drinks faster than the milk flow, kneading helps them promote the flow of milk.
This behavior is brought out in any soft, warm area, including your lap. It is usually done when a cat is satisfied, content or happy. It is the cat's way of expressing 'I am comfortable with you'. When your cat kneads excessively in your lap, it means it has may have adopted you as a mother-figure.
Cats may also knead when they are sexually active. It is very common for female cats in heat to exhibit kneading. In male cats, it is a mating ritual. When your male cat becomes too aggressive while kneading, you better move out of his way.
There is another reason for cats to carry out this unusual behavior. Cats have scent glands on their pads. They are located near the base of their claws. This scent unnoticeable by humans is used to mark territories. Other animals including felines can sense these distinctive smells. Cats use this method to mark the boundaries along their territories.
Thus, the next time your cat kneads on your carpets or pillows there may be a chance it is in "kitten-mode" or marking its territory. If your cat kneads in your lap, hold your head high, as she may be marking you with her scent, proclaiming to the world that you belong to her!