What happens to the content of RAM when a computer turns off?
It is for the same reason that when you remove power from an LCD screen that it will go black. The same as a light bulb and millions of other electrical devices. Because in order to do work such as providing light or movement or storing data they require a constant flow of electricity.
Once that flow is interrupted then the process that does the work will stop and the state that was being maintained by the electric current will stop as well.
The state of a bit of RAM requires constant application of electrical energy to retain state, otherwise that state is lost. The devices are said to be "volatile". This is a feature of fast switching electronic devices.
But you say that hard drives do not loose data when power is removed. Hard drives, SSDs and the like require power to change the state of bits of data. Left without power the data will not change. This is due to the way the data is stored.
In hard drives the work is done by forcing the magnetic field in an material to flip direction, in much the same way as you can magnetise a needle by rubbing it with one end of a magnet. The needle will have a magnetic field that is aligned depending on which end of the magnet you used. You can remagnetise a needle using the other side of a magnet and it will flip the direction of the magnetic field. This change in magnetic field is, for all intents and purposes, permanent until work is done to change it.
This change in magnetic field is a change to the fundamental material and is a feature of how we store data on "non-volatile" media like hard disks. SSDs work differently. By trapping electrons in an area of circuitry they store bits of data but it still requires work to make a physical change to the value of the data.
The difference between the two is that one method of storing data uses power to hold the data, the other uses power to force a physical change in a material.
But these two methods have different benefits. Using power to hold data in volatile devices allows those devices to be changed much more quickly, up to millions or billions of times a second, while non-volatile devices are far slower due to the physical nature of the changes that happen.
Ok, let's start from the basics. RAM stands for Random Access Memory and it is volatile. When you shut down your computer, RAM clears out and there is no data stored in it.
If your operating system is Windows, then there are two modes that are related to this. One is Hibernate mode and the other is Sleep mode. When your computer is sleeping, it is still on and everything you have open is stored in RAM. When your computer is hibernating, everything is stored on your Hard Disk.
If you would like more information, then please edit your question to be more specific and worded better.