How can you castle legally in Chess960 when the castling rook is on the king's destination square? According to the FIDE Laws of Chess:


  4.4 If a player having the move:
  4.4.1 touches his king and a rook he must castle on that side if it is legal to do so
  4.4.2 deliberately touches a rook and then his king he is not allowed to castle on that side on that move and the situation shall
  be governed by Article 4.3.1


Yesterday in the semi-finals of the Chess960 World Championships in the following position Nepomniatchi tried to castle kingside by first picking up his rook to move it off the king's destination square (g1) to f1, the rook's destination square and then moving the king to g1. 

The arbiter ruled in accordance with 4.4.2 that he was not allowed to castle kingside and the king must stay on e1 and he got a bad position. Later, after an appeal, this was overruled and they replayed the game.

 [title "Neponiatchi - So, 2019 Chess960 1/2 final"]
 [fen "2nr1r1k/pb1n1pqp/1p2p1p1/1N1pN3/5P2/1P4P1/P2PPQ1P/2R1K1RB w - - 0 1"]


Jonathan Tisdall, on Twitter, reported that:


  According to organizer Jøran Aulin-Jansson, the rook being on g1, the
  king destination, caused enough confusion to overturn the strict
  ruling


This raises the question: In such situations how can the player legally castle on the side where the rook starts on the king's destination square?

One humorous, though impractical at short time limits, solution was suggested here.

Even more impractical was MrDodgy's suggestion:


  A true pro would pick up the rook from g1, toss it up in the air,
  slide the king to g1 and the rook would land dead centre of f1.  Press
  the clock, lean back in chair.  Flex.


Still illegal.
The FIDE Laws of Chess actually cover this with a recommendation without mentioning the problem.


  II.3.2.5.1 When castling on a physical board with a human player, it
  is recommended that the king be moved outside the playing surface next
  to his final position, the rook then be moved from its starting
  position to its final position, and then the king be placed on his
  final square


The first time I read this I though "What a daft thing to suggest? Who is going to do that?" but now I see the point.

The FIDE Laws of Chess go on to state:


  II.3.2.7 Notes
  II.3.2.7.1 To avoid any misunderstanding, it may be useful to state "I am about to
  castle" before castling.


Suppose Nepomniatchi had read that before and said those words before castling, would the arbiter have allowed him to castle the way he did?

So, it looks like this was thought of when the rules were written and they were written accordingly.

For practical play there is a simpler solution. According to 4.4.1 touching the king then the rook must be followed by castling. In cases where either the rook is on the king's square or the king is on the king's square just touch king then rook and then make the move. This solves all the associated problems.