If I buy a Galaxy S7 Edge from RW (or any other RW phone) then after 1 year decide to leave RW and go with another provider, is the phone unlocked so that it will work with other providers?
Yes. All the new phones come unlocked. so you can move to another provider if you want to. These are the new 3.0 phones only. 2.0 and 1.0 phones are carrier locked.
The new 3.0 phones are not locked and do not have the custom ROM chip in them, so they can be used on different carriers.
However, there is no guarantee that a different carrier will accept or support the phone. Many of these carriers have a place on their web site where you can enter the serial number of the phone and check. You might want to try a few within the 14 day return period if this is important to you.
Note that some of the phones are GSM only and some are GSM/CDMA. The GSM/CDMA phones give you more options, including Verizon or Sprint networks.
then after 1 year decide to leave RW
You are free from day zero. RW has no contracts locking you/phone to the service.