The main objectives of a root canal treatment are-
1)To debride and disinfect the root canal system
2) Sealing the root canals after proper shaping/contouring them, completely with a well compacted inert filling material to eliminate all portals of entry between periodontium and the root canal.
Now an abscess develops after the infection has reached the periradicular tissues through various foramina of the root canal involving the periodontal ligament and periradicular bone.
Now the abscess is actually the purulent exudate.
During the root canal procedure after the access opening and location of the orifices, each root canals are instrumented within 1mm of the root apex.
Irrigation (for eradication of microorganisms and complete removal of minute fragments of organic debris, necrotic tissue, etc) and debridement are continuously done. Due to this, purulent discharge escapes into the pulp chamber from the periradicular tissues. As now it has got a way to come out. This now indicates patency of root canal and drainage.
After this root canal is sealed with an obturating material. Now since the purulent exudate is out of the area along with bacteria and toxins while cleaning and shaping in RCT what is left in the periradicular area is the affected periapical bone and periradicular ligament which heal in few months.
The swelling due to the abscess if present generally disappears in 24-48 hours after establishment of drainage.
However a lot of times the drainage developed by the patent root canal is not enough and in those cases incision is through soft tissue to the bone using scalpel. Trephination (surgical procedure of alveolar cortical plate to create a channel for the release of the accumulated tissue exudate) followed by decompression (placement of a drain tube for facilitating exudate drainage)can also be employed when the abscess is extensive.
Extensiveness of an abscess plus whether it's acute or chronic can be assessed by the patient's signs and symptoms as well as radiographic and histologic examination.
I hope this clears all your doubts :)
References- Grossman's endodontic practice 13th edition.