If the dental pulp in the middle of the tooth gets injured, or infected by deep caries, it can become inflamed, and you would experience a tooth ache. The pain may persist for hours, even after the aggravating event (e.g. biting) has passed. This is a sign of pulpitis – inflammation of the dental pulp.
If the tooth is badly decayed, it may have to be extracted. If the tooth structure is relatively intact, and the gums are healthy, you can save the tooth by undergoing root canal treatment. The dentist will open an access hole under local anaesthesia, and remove the dead or dying dental pulp tissue, disinfect the root canal, dry it, then place a root filling inside the root canal to seal it.
Treating a decayed tooth early with a filling when the cavity is small not only saves you from pain, it saves you the cost of expensive dental work like root canal treatment and crowning.
The pulp in the root canals has been removed, and replaced with a filling material.
See also: Keeping your wisdom tooth