How does iMessage sync messages across devices?
It is the same mechanism where the messages get delivered in the first place. The server(s) maintain a database of registered devices and issue a message to the each device. 

Of note, each device receives a unique message - the encryption is one to one from the push servers to each device and not a broadcast of the same raw message to multiple devices. Once decrypted, the content is the same, but each instance of the “same message” has different keys and different payload data while encrypted.