Now that Bran Stark's creepy stare has cemented him as one of the most mysterious characters on Game of Thrones, it's hard to imagine a time when he wasn't so in tune with his Three-Eyed Raven identity. But he hasn't always known about his powers to see past, future, and current but slightly distant events. He had to learn how to use them, and it was in that time that he had a terrifying encounter with the Night King. As Bran mentions in the second episode of the final season, the Night King once left him with a mark that enables the undead leader to know his location.
If your memory of the past isn't as clear as Bran's, the Night King leaves this mark in season six. At that point, Bran's already met the previous Three-Eyed Raven after going on a mission beyond the wall to find him — though back then, he'd been dreaming of a literal raven with three eyes and didn't think he'd find an old man fused to a weirwood tree. The old Three-Eyed Raven begins training him in the art of greensight. This involves not just seeing visions of past and future events, but being present in them as well. As such, the old Three-Eyed Raven warns Bran not to interfere with the visions.
One of the past visions the old Three-Eyed Raven shows Bran is the creation of the first White Walker by the Children of the Forest. They learn that the Children did this to prevent the first humans in Westeros from continuing to destroy weirwood trees, which they consider sacred. In the present, Bran, who hasn't reached the point of mastery of his abilities yet, ends up connecting to the old Three-Eyed Raven's weirwood tree without telling him. In this vision, he sees even more White Walkers and wights — including the Night King. Aware of Bran's presence and likely that he wasn't supposed to be there, the Night King grabs his arm, which ends the vision.
The Night King's Touch leaves a mark on Bran, and it's apparently like a GPS system that lets him know exactly where Bran is at all times. That's great for the Night King — whose end goal is to destroy everything. Killing Bran, as Sam Tarly explains, means killing all memories. But it could work in the living's favour, too. Like they've planned, they can use Bran to lure the Night King close enough to defeat him. Will they succeed? We could really use greensight to tell us right about now!