Sometimes we see the right wing next to the touch line during a set piece, and other times he is amongst the backline.
Does the team having the ball determine this or how and when does it work ?
It's up to the team how they play,
While there are set positions and roles, players can go anywhere during a set play, really. You could have a prop on the wing if it suited what you wanted to acheive with that play