How does iMessage work?
In a nutshell, iOS sets up a persistent connection to the Apple Push Notification (APN) servers if you elect to use iMessage, iCloud, Notifications or other push services. From there, the phone checks in with the servers anytime it has a network connection and listens for messages that the servers wish to push to your device. Furthermore, iOS then registers which applications on your phone should get specific messages. All the messages pass through the notification center system in case you have elected for them to be posted to specific places such as the lock screen, the notification tray or just passed off to the end application for each message as appropriate.

That's it.


There's a server. (likely many behind a load balancer)
There's a connection that your device opens to the server.
Things can then arrive through the connection.