Interesting. Some time ago, I think it was in High Sierra I had a Mac what took a lot of time to show the iCloud folders and I installed this Cirrus (or another similar tool) that showed what was happening in the background, and as it appears that nothing was happened, internally was working “fast and furious” trying to get the files.
However, cloud sync is easiest that is seems. When you modify a file or create a new one, it is uploaded, verified the upload and an entry added to the table of files, ordered by upload/modification time. (However, seems iCloud downloads one more time the file to check it is ok and to replace the uploaded one). If there is enabled the “placeholder” stuff, the file is replaces by a placeholder containing the metadata needed to get back the file. (In iCloud Drive, it is a .iCloud text file containing an UUID and nothing visible more).
When a file is modified externally, a notification is sent to all active machines and then the file is checked and downloaded (placeholder or file itself).
What could be wrong? Local file is locked (you get a duplicate), local file has a timestamp too near to the remote one (you get a duplicate). Clocks in devices could be not in sync, then iCloud/Dropbox/whatever needs to have an internal timestamp stuff, perhaps the most complex thing to implement here.
If your device has been switched off, or has not received the notification, the only things that local machine needs to get is the list of the last modified files since last connection. And this is the reason once you switch on a device, ten seconds after you get (from Dropbox and OneDrive, but not from iCloud Drive due “dark” Apple way to do the things) a notification that X files have been modified/added, basically the time to check those files against local filesystem.
When a device is not connected, and two same files have been modified in different machines, you get duplicates as well.
What is very complex is the “placeholder” technology, that must be implemented at low level operative system driver, as it finally has been done both by Microsoft and Apple. And in both cases, first incarnation of this technology failed miserably (in Windows 8 for Windows, and in previous versions in macOS). And it seems both companies have shared their how-know to make this possible, as both Windows/macOS got more or less at the same time the now stable “placeholder” tech, I think it is the same as OneDrive and iCloud both works fine in Windows and macOS and icons, menus and other things are completely similar. Most critical thing here is have a hook to pass to the cloud controller the file that is being opened to download it.