When he was young, it hurt:
- when Voldemort was close to him
- when Voldemort felt strong emotions
It is my belief that your scar hurts both when Lord Voldemort is near you, and when he is feeling a particularly strong surge of hatred*.
(Goblet of fire, Chapter 30, The pensieve)
* or joy, as we discover later - but that is off topic
Also, he had "dreams" about Voldemort, that were in fact incursions in Voldemort's mind and let him see what Voldemort saw, heard, did.
The evidence suggests that at times, when your mind is most relaxed and vulnerable — when you are asleep, for instance — you are sharing the Dark Lord’s thoughts and emotions.
(Order of the Phoenix, Chapter 24, Occlumency)
But neither the scar nor the dreams were ever anything like divination features. He could not see the past, nor the future, not even what might be the future.
So after Voldemort is fully dead, he shouldn't feel any of these signs anymore.
In the Cursed child,
actions take place that induce a risk of Voldemort "coming back" or at least "be there".
And, as a "warning signal", Harry's scar hurts and he's having weird dreams. Why??