How does Apple Watch backup work? Does the Apple Watch use the same mechanics of the iPhone in terms of backup data in the cloud? 

For example, if for any reason, such as password forgot or whatever you need to reset to factory setting the apple watch, can you make a restore from a backup or do you need to sync again all the info from the Apple Watch app on your iPhone? How does it work? 

I am pretty sure that I understood that when the Apple Watch is paired with the iPhone it continuously sync data with the iPhone and the iPhone itself does the cloud back up, but I would like to know more about it.
Yes, the Watch uses basically the same mechanics as the iPhone, since it more or less piggybacks it's backup with the iPhone's backup.

In your given example you would likely want to first unpair the Watch in the Apple Watch app on your iPhone.  You might notice that the unpair process takes a while (a minute or two) compared to unpairing of other bluetooth devices, this is because the Watch automatically backs up to the iPhone when unpairing is initiated.  When you pair the Watch back to the iPhone you will be prompted to set it up as new or restore from a backup, similar to how an iPhone asks when you first set it up.

Source - Just had this conversation with an Apple Genius yesterday when dropping my Watch off for service.

This Apple KB article explains this as well - HT204518 Back up your Apple Watch