user23596: As the title says let's say it is a 1 hour 30 minute game with 30 seconds increment/move. Now if someone deliberately presses the clock at the last second without moving to avoid flagging and get the 30 second increment. How is this handled?

Is it counted as an illegal move (I believe 2nd illegal is lost)?
If it is counted as an illegal move does he get to keep the 30 seconds added while the opponent get the 2 minutes extra?

Simply can someone use this as a trick to avoid getting flagged out of desperation?

user4418: 
Is it counted as an illegal move (I believe 2nd illegal is lost)?

The FIDE Laws of Chess are very clear on this:

7.5.3    If the player presses the clock without making a move, it shall be considered and penalized as if an illegal move.

So, yes.

If it is counted as an illegal move does he get to keep the 30 seconds added while the opponent get the 2 minutes extra?

Not if the arbiter is any good.
But note that the player would gain thinking time while the opponent works out what has happened, stops the clocks, calls the arbiter, explains to the arbiter what has happened, the arbiter makes the (hopefully correct) decision and adjusts the clocks.
That could still be very valuable and is likely to also be taken into consideration by the arbiter who might warn the player that any repeat such action could lead to automatic loss and maybe even ejection from the tournament.

23596: <p>As the title says let's say it is a 1 hour 30 minute game with 30 seconds increment/move. Now if someone deliberately presses the clock at the last second without moving to avoid flagging and get the 30 second increment. How is this handled?</p>
<ol>
<li>Is it counted as an illegal move (I believe 2nd illegal is lost)?</li>
<li>If it is counted as an illegal move does he get to keep the 30 seconds added while the opponent get the 2 minutes extra?</li>
</ol>
<p>Simply can someone use this as a trick to avoid getting flagged out of desperation?</p>
 4418: <blockquote>
<p>Is it counted as an illegal move (I believe 2nd illegal is lost)?</p>
</blockquote>
<p>The <a href="https://handbook.fide.com/chapter/E012018" rel="noreferrer">FIDE Laws of Chess</a> are very clear on this:</p>
<blockquote>
<p>7.5.3    If the player presses the clock without making a move, it shall be considered and penalized as if an illegal move.</p>
</blockquote>
<p>So, yes.</p>
<blockquote>
<p>If it is counted as an illegal move does he get to keep the 30 seconds added while the opponent get the 2 minutes extra?</p>
</blockquote>
<p>Not if the arbiter is any good.</p>
<p>But note that the player would gain thinking time while the opponent works out what has happened, stops the clocks, calls the arbiter, explains to the arbiter what has happened, the arbiter makes the (hopefully correct) decision and adjusts the clocks.</p>
<p>That could still be very valuable and is likely to also be taken into consideration by the arbiter who might warn the player that any repeat such action could lead to automatic loss and maybe even ejection from the tournament.</p>
