How does heart and sleep monitoring work

I recently purchased a Samsung gear and I heard that the newest iteration have integrated heart rate monitors and upgraded sleep monitoring. Having read reviews online, I saw that heart rate monitors on mobile phones are not very accurate. Is that true? How can a watch monitor my sleep, what sensor does that?
