The ball is out of play when:
it has wholly passed over the goal line or touchline on the ground or in the air
play has been stopped by the referee
it touches a match official, remains on the field of play and:
a team starts a promising attack or
the ball goes directly into the goal or
the team in possession of the ball changes
In all these cases, play is restarted with a dropped ball.