Below you will find a dental X-ray. I outlined the location of the maxillary sinus (the sinus located above the upper teeth) so that you can see how close it is to the roots of the upper molars.
On the left, it appears that the base of the sinuses is below the base of the maxillary molars. This is usually not the case. When we see two-dimensional images of three-dimensional objects, this illusion can be attributed to overlap. However, it does give you a good idea of why sinus infections can cause toothache in your upper molars and premolars.