A shot clock violation in basketball is an offensive possession that fails to have a shot attempt that touches the rim or goes in the basket before the shot clock has expired. The shot clock lasts a different amount of time in the NBA and in the NCAA.
In the NBA the shot clock lasts only 24 seconds. Since the shot clock is so low, teams have to get a shot off much quicker and be more efficient on offense. Defenses can be a bit less aggressive, since the shot clock is working against the offense.
In the NCAA the shot clock lasts 30 seconds.. This is a full 6 seconds longer than in the NBA, so offenses can take a bit more time with the ball. This also means that late in the game, teams can let the clock run more easily, taking up half a minute per possession!
If a team commits a shot clock violation, play is stopped and possession of the ball is awarded to the other team. It's always better to take a shot, no matter where you are on the court, than take a shot clock violation.
In the NCAA, the shot clock used to last 35 seconds. This was changed before the start of the 2015-16 season, when the NCAA shaved off five seconds from the shot clock.
Up until 1993-94, the NCAA shot clock was 45 seconds long. This rule was put in place in 1985-86.
As long as the player releases the ball before the shot clock expires, and their shot then hits the rim or goes into the basket -- the shot clock will be reset. This is similar to the rule which allows a basket to count as long as the ball was released before the game clock expires.
However, remember that in this case the player is shooting the ball and is not guaranteed to retain possession, as the potential rebound will be up for grabs.
When the shot clock expires, three things happen:
The lights on the backboard help show when exactly the shot clock expired for the referees and for a potential video review.
The horn alerts the players and referees that the shot clock has expired right when it happens. If a shot clock violation was ruled, then the horn will create a stoppage in play.
Remember that just because the horn goes off, there was not necessarily a shot clock violation. If, when the horn goes off, a shot has already been taken and it hits the rim or goes in, there will be no shot clock violation.