Does macOS have hibernation where no power is used?
Does macOS have hibernation mode which works exactly like hibernation in Windows (RAM is saved to the disk and power is switched off)?
When I use hibernation in macOS, computer still consumes energy. Is it possible to set it somehow, so that power is switched off after hibernation?
Yes, Mac OS X does have this feature. It is known as "hibernate mode" where as the other modes you have experienced are normally known as variations of "sleep mode".
For older laptops (before 2005), hibernation was actually the default mode of operation. For newer laptops that is no longer the case.
You can see the current mode in use with a command line like this:
pmset -g | grep hibernatemode
You can set the mode using a command line like this:
sudo pmset -a hibernatemode 1
Where "1" means hibernation. The default for newer laptops is mode "3", which is known as safe sleep.
Note that you might experience problems in practice with newer laptops. It might not be possible to keep them in hibernation with only the above mentioned command. You can experience that for example external peripherals and the Power Nap feature wake up the computer unexpectedly. YMMV.
If you rather want a GUI utility than fiddle with commands like above, you can use a program such as SmartSleep to set the sleep/hibernation mode:
https://www.jinx.de/SmartSleep.html
Note however that it doesn't seem to support the latest macOS releases, so it is probably only applicable to a bit older laptops.
sudo pmset -a hibernatemode 25 standby 1 standbydelayhigh 1 standbydelaylow 1 autopoweroff 1 autopoweroffdelay 1
will set the power management policy to force supported systems to enter safe sleep followed by ACPI S5, i.e., power off, upon a user-initiated sleep. Note that this will disable most wake sources, so on many machines the only way you'll be able to wake is by pressing the power button.