If you cast prayer of mending on yourself or a target without anyone around for it to jump to, it will not heal when you initially take damage. It will first use all 5 stacks of prayer of mending every time you take damage and on the very last stack it will heal you.
It seems to only heal when it jumps to another target. If there’s noone to jump to, instead of healing and then disappearing, it just doesn’t heal and stays on the target.