Understanding Interrupts

What causes the interrupt to start the query of the sensor?

Interrupts are processed when they occur - so your long while loop would stop, the interrupt processed, and the loop continues from where it was.