In a very stupid manner.
http://wiki.guildwars.com/wiki/Hero_behavior
It's all a matter of how anet programs them to do...which is the way they saw best when making the skill with adjustments normally only when a skill is totally changed...
It more then likely takes into account health and energy as well as conditions that need to be met for the skill to work. But I really dont know all the details.