What happens if a team take elect to take a kick at goal and the ball accidentally or intentionally goes into touch? E.g. what if they elect to kick at goal from their own 5m to run down the clock in the last minute of a game and then kick it into touch? Would they still get a throw in to a lineout as if they had kicked the penalty from hand into touch?
In relation to Rugby Union:
If it was deliberate - as in the kicking team called for a penalty shot and intentionally kicked it into touch - then no, they would not be awarded a line-out.
Firstly, under Law 8 - Scoring
If the team indicates to the referee the intention to kick at goal, they must kick at goal. The intention to kick can be communicated to the referee or signalled by the arrival of the kicking tee or sand, or when the player makes a mark on the ground.
Therefore meaning that once the signal for the shot at goal had been made, they cannot then decide to kick to touch.
Secondly, under Law 20 - Penalty and free-kick
The kicker may punt, drop-kick or place-kick (other than for touch) the ball.
Implying that you cannot kick for touch from a place-kick.
In the old laws - that is to say, before they were restructured and simplified in 2018 - there used to be a clause on infringements made by the kicking team which said:
Unless otherwise stated in Law any infringement by the kicker’s team results in a scrum at the mark. The opposing team throw in the ball.
Source for above is from the article linked at the end
Which I interpret to mean that if the kicking team deliberately kicked to touch off a place-kick, then the other team will be awarded a scrum at the mark of the previous penalty.
If it was unintentional - for example the wind was so strong it blew the ball out into touch, or the ball hit the post and bounced out into touch - then a lineout would be given to the defending / non-kicking team assuming that the ball was not touched by another player.
The latter of those two scenarios has actually happened - in 2016, against Australia, Nicolas Sanchez of Argentina took a penalty kick, which hit the post and bounced into touch. This resulted in a lineout to Australia.
The ruling for this can be found in a Law Clarification from 2006 (Clarifications carry the same force as Law)
Following a penalty kick and after the ball was kicked, the ball hits the goal post and goes into touch without having been touched by another player. What decision should the referee give?
Ruling of the designated members of the Rugby Committee
If the penalty kick is for goal, then it is a lineout defending team to throw in. Law 21.4(d).
Note: the 21.4(d) is in relation to the old Laws structure
This was discussed in this article of the event.
In rugby union, if - in the very unlikely event - a shot at goal goes into touch, there are two possible scenarios:
- If there is still time on the clock, the game would restart with a lineout and the team kicking would throw it in.
- If there was no time left on the clock, the game would not restart with a lineout and the game would end.
This is a similar situation to if the shot at goal misses the posts and goes over the dead ball line. In scenario  if there is still game time, the game starts with a 22 metre drop out. In scenario , as there is no more game time, so game over.
In scenario  the kicking team has taken the 'advantage' to shoot for goal on the final play. They don't get a second chance.