Fleas undergo a "complete" life cycle, similar to a butterfly or moth. The four stages are;
the egg, the larva, the pupa, and the adult (biting stage).
The female flea lays her eggs, several hundred of them in her lifetime, on your pet. The eggs fall off the pet onto the surface below. The eggs hatch in just a few days, and become the larva.
The larval stage you will never see. They live in the thatch of the carpet and avoid light and activity. You also are not bitten by the larvae. The larva feeds for around 10 days and then goes into the pupa, or cocoon stage, by wrapping local debris around itself with a sticky material that causes it to adhere to the carpet fibers.
Inside the pupa the adult flea develops. Some will hatch in a few days and some that may stay in that pupa case for over 6 months.
It may be the vibration of the animal (or people) walking on the carpet, or the physical contact of being stepped or sat upon, that causes the adult flea to emerge within seconds after resting there for a long time.
This is important for performing effective treatments.
To rid yourself of fleas, you MUST kill the adult fleas and the larvae, and also to kill flea adults that emerge over the next couple of weeks.