Flyback discontinuous mode, double voltage over the switch
When the power switch closes, the primary side of the transformer "sees" \$V_{in}\$ if you neglect all the drops. During this on-time, the secondary-side diode sees its anode biased at \$\frac{V_{in}}{N}\$ while its cathode is biased at \$V_{out}\$. The peak inverse voltage or PIV of the diode is thus \$\frac{V_{in}}{N}+V_{out}\$. You select the diode breakdown voltage based on this reverse-bias condition with some margin applied.

When the power switch opens, the primary-side current is scaled by the transformer turns ratio and circulates in \$D_1\$. As this diode conducts, the secondary side of the transformer sees \$V_{out}\$ as long as \$D_1\$ conducts. This voltage "flies" back to the primary side of the transformer hence the name flyback converter. The switch now sees the series combination of \$V_{in}\$ plus the reflected voltage: \$V_{sw}=V_{in}+NV_{out}\$. You have \$2V_{in}\$ at the switch terminal if \$NV_{out}=V_{in}\$ and this is a very weird example in my opinion.

The power switch must thus be selected to withstand this level plus the leakage inductance contribution.

When the primary inductance is fully demagnetized within the switching cycle (discontinuous conduction mode or DCM), \$D_1\$ stops conducting and the switch voltage returns to \$V_{in}\$. These are idealized waveforms as parasitic inductors and capacitors ring during transitions. You have more explanations on the flyback converter in this seminar.