Folders have two functions. The first is that they help you structure your materials. When you have a lot of layers you should start using folders to structure your material better.
The second is that you can group layers together to apply masks or hide them.
You can move layers into a folder when it is open. If it's closed the layer will be moved below the folder and all layers inside it.
You can only hide a folder in Layer mode, meaning you cannot hide specific channels.
You can display settings from layers inside the folder on the folder itself. This means that you can expose certain settings that are the main controls of the sub material in the folder to access them more quickly.
Right click the setting you want to expose to the folder and check 'Show In Folder'. There might be a few special cases where the setting can't be shown, if you find one of those please report it.
You can only add masks for the Layer mode, meaning you cannot add masks for specific channels. The masks will be applied to all layers that are inside the folder. Apart from that, adding masks works the same it does for other layres.