There are LED (light emitting diode) lights placed around the court. One of those spots is inside of the backboard. It runs along the border of the backboard with there being a total of four strips.
Those strips light up red to signal the end of either the shot clock or the game clock. There are also lights at the scoring table and all around the arena.
Basketball Shot Clock
Atop the basketballhoop is a clock that displays the time remaining in the game as well as in the shot clock. The numbers are LED lights and can be seen from anywhere on the court.
At the end of the shot clock (24 seconds in the NBA and 30 seconds in college) the top strip of LED lights in the backboard flash red.
Similarly, at the end of a period (either quarter or half) all four strips light up red.
Both implementations are done to alert the referees and make it easier to gauge if a final shot was released in time.
Basketball Scorers Table
In some cases at the scorers table there is a horizontal strip of LED lights that flash simultaneously with the backboard light. It also flashes when a substitution is made to alert the players on the court and fans.
On top of the practical LED lights at the scorers table there are sometimes advertisements on the front of the table. Those ads are displayed with colored lights for TV audiences to see. In addition, the ads are sometimes even bordered by more LED lights to further draw attention to it.
Nearly every professional and collegiate basketball team has a scoreboard in their stadium or arena. The scoreboard displays how many points each team has, timeouts remaining, fouls committed, and more. Everything on the scoreboard is lit up and the numbers are all LED lights. The purpose is to make it easy to read for the fans no matter where you are in the stadium.
Basketball Other Lights
Lights are also all over basketball stadiums light as a part of the arena lighting. It used to illuminate the court to allow players to see as well as provide a good viewing experience for fans.