How does the Phaser Listener work?

Can anybody explain how Phaser listens to user input (e.g. when a sprite is turned on, such as in the following case)?

sprite.on(‘pointerup’, function() {
// some code
}

More specifically, how can Phaser suddenly recognize when the sprite is clicked?
And how can I wait for user input (i.e. user clicking on the sprite) before I continue with the rest of my code?