Tooth decay is one of the main reasons that people experience toothaches. Even a tiny cavity can cause significant pain when acids or sugars in the mouth get in it. As the decay worsens, so does the pain caused by it.
A severely decayed tooth will eventually become infected when left untreated, and that causes even more pain. The pain caused by an infected tooth is typically enough to stop a person from getting any sleep at night, and it makes it impossible to concentrate on anything. A tooth infection counts as a dental emergency, and it requires immediate treatment.