If tooth decay gets very deep or sometimes when a tooth has been knocked, the nerves and blood vessels deep inside the tooth (the pulp) can become infected and cause an abscess. When this happens the infected tissue must be removed either by extracting the tooth or by root canal treatment (RCT).
In RCT the diseased pulp tissue is cleaned out using very fine instruments and the tooth is filled all the way inside the roots to try and prevent further infection. The whole process normally takes two visits, although if the tooth is really badly infected it can take more, and you will usually be advised to have the root filled tooth crowned after the infection has all gone because root filled teeth are weaker and more likely to break.