Minecraft wiki entry for Ender_Dragon, associated text: Targeting
Whenever the dragon finds herself less than 10 blocks or more than 150 blocks from her current target, she attempts to choose a new target. When damaged she targets a point just behind herself, causing her to turn away and choose a new target.