We Do Not
It is never explained how their magic works, in fact we know very little about them as a whole. Firstly it is important to address that there is a difference between the White Walkers and wights. The White Walkers are the icy blue guys who look quite skeletal and are the leaders of the army of the dead. The wights are the undead soldiers and more like the traditional zombie. There is also the Night King who is the leader of them as a whole, a White Walker but has a distinct look about him.
We see wights being raised by the Night King at Hardhome in Season 5 Episode 8, "Hardhome". We don't actually know how this works, only that the Night King raises his arms and all of the dead in the immediate area rise as wights.
Note that all White Walkers, not only the Night King, can create wights.
When you killed the White Walker, almost all the dead that followed it fell. Why?
Maybe he was the one who turned them.
Game of Thrones, Season 7 Episode 6, "Beyond the Wall"
Again it isn't exactly clear how the White Walkers are created but we know that the babies Craster was leaving out for them are turned into White Crawlers. We see this happen in Season 4 Episode 4, "Oathkeeper", here there is some sort of ritual taking place and the Night King touches the baby with his hand turning him. It's not clear if the ritual is needed. Also, it only appears that the Night King can create White Walkers.
We see that the Children of the Forest created the Night King in Season 6 Episode 5, "The Door", when Bran sees it. This happens in a ritual style fashion and Leaf inserts a dragonglass dagger into the chest/heart of a First Man. Leaf then admits it when Bran comes back and tells us of her reasoning.
BRAN: It was you. You made the White Walkers.
LEAF: We were at war. We were being slaughtered. Our sacred trees cut down. We needed to defend ourselves.
BRAN: From whom?
LEAF: From you. From men.
Game of Thrones, Season 6 Episode 5, "The Door"
Vicerion Viserion is turned by the Night King who places a hand on his head, like the babies, and wakes him up from the dead. You can see this at the end of Season 7 Episode 6, "Beyond the Wall".