user20721: There are a number of ways a clock can fail during a game.
Battery runs out, player pushes button by mistake and resets it,  falls on floor and breaks, kiddie smashes toggle button hard with captured queen and clock stops [I have seen that kiddie type of hitting the clock hard with a piece usually a queen on several occasions], yada yada.
So what happens if in the middle of a game the clock stops working correctly?
This would clearly impact games more that are nearing the end and players are in time pressure,   as well as for speed games where the delay in correcting the problem would have more significance than at the beginning of a long slow OTB game. 

user4418: This was more of a problem with the earlier generation (early 2000's) of digital clocks. One of them had a fault which meant that if you gave it a bit of a smack then the battery might jiggle inside, momentarily interrupting the electricity supply and it would reset. 
The post 2010 clocks don't have this problem, probably they just fitted a small capacitor to maintain current. Nevertheless most arbiters with more than a few years experience will be familiar with the problem and what to do, having probably handled the situation several times in the past.
The arbiter knows the start time, the current time, the increment and the current move number. From this he can work out how much game time is left. This remaining time is split equally between the two players, the clock adjusted appropriately and the game restarted.
Variations on this scenario can occur if the arbiter has recently had cause to write down the times of the clocks and thereby take into account different amounts of time taken, however this information has to be very fresh to be fair since somebody who was 5 minutes ahead on the clock quarter of an hour ago could easily be 5 minutes behind now.
If both players have been recording the time and have up to date time notations which match then these could be used. If only one player has such notations then they can only be used if both players agree.
If the clock is faulty it should be replaced and this entails a follow up rule for tournament organisers, that they should have several spare, working clocks with good batteries available.
Also worth noting that for more critical games the arbiter should move the players away from the board while sorting out the problem. Calculating the adjustments to be made and replacing the clock will take a couple of minutes and if the players are allowed to sit in front of the board then this could confer an unfair advantage in additional thinking time for one of the players.

user19877: Per FIDE rules 6.10a and 6.10b (I am including the latter since it is so closely related in that it can require the arbiter to adjust the times based on judgment):

6.10 a. Every indication given by the clocks is considered to be conclusive in the absence of any  evident  defect.  A  chess  clock 
  with  an  evident  defect  shall  be  replaced.  The  arbiter  shall 
  replace  the  clock  and  use  his  best  judgment  when  determining 
  the  times to be shown on the replacement chess clocks
6.10 b. If  during  a  game  it  is  found  that  the  setting  of  either  or  both  clocks  was  incorrect,  either player or the
  arbiter shall stop the clocks immediately. The arbiter shall install
  the  correct  setting  and  adjust  the  times  and  move  counter. 
  He  shall  use  his  best  judgement when determining the correct
  settings.

Per USCF rules:

16 O. Defective clocks. Every indication given by a clock is considered
  to be conclusive in the absence of evident defects. A player who
  wishes to claim any such defect must do so as soon as aware of it. A
  clock with an obvious defect should be replaced, and the time used by
  eachplayer up to that time should be indicated on the new clock as
  accurately as possible. The director should use judgment in
  determining what times shall be shown on the new clock. A director who
  decides to subtract time from one or both players shall leave that
  player(s) with the greater of either five minutes to the time control
  or at least one minute for each move the player still needs to meet
  the time control.

Again, I am going to include this since it is closely related, and is akin to what I posted for FIDE above.

16 P. Erroneously set clocks.An erroneously set clock should be
  handled in the same fashion as a defective clock. As in 16O, the
  director should use judgment in deciding whether to make time
  adjustments. The most common situation of this type involves an analog
  clock set to expire at 7:00 rather than the correct 6:00. This is best
  handled by pointing out to both players that the time control expires
  at 7:00. Clocks can also be reset for the correct time controls and
  the correct elapsed timefor each player.Sometimes this hour difference
  is not pointed out and there is an eventual time claim. Even though
  the clock may show 6:00 with a flag down, or the signaling device on a
  delay or digital clock indicates a flag fall, if the total elapsed
  timeshown for both players is about an hour more than possible,
  considering when the game started, the player should not be forfeited,
  and should be given the hour in question.


20721: <p>There are a number of ways a clock can fail during a game.</p>

<p>Battery runs out, player pushes button by mistake and resets it,  falls on floor and breaks, kiddie smashes toggle button hard with captured queen and clock stops [I have seen that kiddie type of hitting the clock hard with a piece usually a queen on several occasions], yada yada.</p>

<p>So what happens if in the middle of a game the clock stops working correctly?</p>

<p>This would clearly impact games more that are nearing the end and players are in time pressure,   as well as for speed games where the delay in correcting the problem would have more significance than at the beginning of a long slow OTB game. </p>
 4418: <p>This was more of a problem with the earlier generation (early 2000's) of digital clocks. One of them had a fault which meant that if you gave it a bit of a smack then the battery might jiggle inside, momentarily interrupting the electricity supply and it would reset. </p>

<p>The post 2010 clocks don't have this problem, probably they just fitted a small capacitor to maintain current. Nevertheless most arbiters with more than a few years experience will be familiar with the problem and what to do, having probably handled the situation several times in the past.</p>

<p>The arbiter knows the start time, the current time, the increment and the current move number. From this he can work out how much game time is left. This remaining time is split equally between the two players, the clock adjusted appropriately and the game restarted.</p>

<p>Variations on this scenario can occur if the arbiter has recently had cause to write down the times of the clocks and thereby take into account different amounts of time taken, however this information has to be very fresh to be fair since somebody who was 5 minutes ahead on the clock quarter of an hour ago could easily be 5 minutes behind now.</p>

<p>If both players have been recording the time and have up to date time notations which match then these could be used. If only one player has such notations then they can only be used if both players agree.</p>

<p>If the clock is faulty it should be replaced and this entails a follow up rule for tournament organisers, that they should have several spare, working clocks with good batteries available.</p>

<p>Also worth noting that for more critical games the arbiter should move the players away from the board while sorting out the problem. Calculating the adjustments to be made and replacing the clock will take a couple of minutes and if the players are allowed to sit in front of the board then this could confer an unfair advantage in additional thinking time for one of the players.</p>
 19877: <p>Per FIDE rules 6.10a and 6.10b (I am including the latter since it is so closely related in that it can require the arbiter to adjust the times based on judgment):</p>

<blockquote>
  <p>6.10 a. Every indication given by the clocks is considered to be conclusive in the absence of any  evident  defect.  A  chess  clock 
  with  an  evident  defect  shall  be  replaced.  The  arbiter  shall 
  replace  the  clock  and  use  his  best  judgment  when  determining 
  the  times to be shown on the replacement chess clocks</p>
  
  <p>6.10 b. If  during  a  game  it  is  found  that  the  setting  of  either  or  both  clocks  was  incorrect,  either player or the
  arbiter shall stop the clocks immediately. The arbiter shall install
  the  correct  setting  and  adjust  the  times  and  move  counter. 
  He  shall  use  his  best  judgement when determining the correct
  settings.</p>
</blockquote>

<p>Per USCF rules:</p>

<blockquote>
  <p>16 O. Defective clocks. Every indication given by a clock is considered
  to be conclusive in the absence of evident defects. A player who
  wishes to claim any such defect must do so as soon as aware of it. A
  clock with an obvious defect should be replaced, and the time used by
  eachplayer up to that time should be indicated on the new clock as
  accurately as possible. The director should use judgment in
  determining what times shall be shown on the new clock. A director who
  decides to subtract time from one or both players shall leave that
  player(s) with the greater of either five minutes to the time control
  or at least one minute for each move the player still needs to meet
  the time control.</p>
</blockquote>

<p>Again, I am going to include this since it is closely related, and is akin to what I posted for FIDE above.</p>

<blockquote>
  <p>16 P. Erroneously set clocks.An erroneously set clock should be
  handled in the same fashion as a defective clock. As in 16O, the
  director should use judgment in deciding whether to make time
  adjustments. The most common situation of this type involves an analog
  clock set to expire at 7:00 rather than the correct 6:00. This is best
  handled by pointing out to both players that the time control expires
  at 7:00. Clocks can also be reset for the correct time controls and
  the correct elapsed timefor each player.Sometimes this hour difference
  is not pointed out and there is an eventual time claim. Even though
  the clock may show 6:00 with a flag down, or the signaling device on a
  delay or digital clock indicates a flag fall, if the total elapsed
  timeshown for both players is about an hour more than possible,
  considering when the game started, the player should not be forfeited,
  and should be given the hour in question.</p>
</blockquote>
