A healthy tooth has a pulp chamber and canals running up (or down) through the roots. This is where the nerves and blood vessels are to be found.
Pulp tissue is extremely vulnerable to inflammation and infection (abscess). Deep cavities, trauma, heavy bite and other factors can cause this to happen.
A dying or dead pulp can often neither be predicted nor prevented. Your dentist will seek to remove dead or diseased pulp from the root canals without discomfort as with any other procedure. Some discomfort may be experienced following treatment but this is usually short-lived not a cause for concern.