In college and the NBA, when the ball is dead or your team has it. In high school, when your team has control of the ball, and check your state association's book for dead-ball timeouts.
Both NCAA books and the NBA grant a timeout when the ball is dead. During live play, high school, both NCAA books and the NBA grant one to the team in control of the ball. When the other team has the ball live, no level grants you a timeout.
FIBA is the big exception. It never grants a timeout during live play. A FIBA time-out opportunity starts when the ball is dead with the game clock stopped, after a made last free throw, or for the team scored on after a goal.
There are smaller rules too. NCAA men's head coaches can only get one in live play on their own throw-in before the release, or with the clock running in the last two minutes. The NBA grants no timeout to an airborne player whose body has broken the plane of a boundary line.
Here is an example. Your guard is trapped in the corner and is about to lose the ball. In high school, college or the NBA, he can call timeout as long as he still controls it. Teach your players when they are allowed to call one, and when you want them to, before the season.
More In-Game Coaching questions
Free playbook
Get the free flex offense playbook
Every flex cut, starting set, counter, special and drill, with all 30 diagrams, in one printable PDF.