When decay has extended into the centre of the tooth and infected the nerve, a dental abscess is formed which is usually very painful.
Rather than extracting these teeth it may often be possible to save the tooth by cleaning out the infected remnant of the nerve in the tooth and sealing up the space where the nerve used to be. This is called a root filling and unless there are other considerations, these days it is routine to save an abscessed tooth.