What is flag in soccer?
A visual indicator used by assistant referees during play. Assistant referees are located on the sidelines and will wave the flag to denote the direction of play and which team gets possession of the ball following an out of bounds play or another infraction.
Officials, particularly linesmen, use flags to signal offsides, throw-ins, goal kicks, corner kicks, and the direction of possession after fouls or out of bounds plays. Linesmen will also wave their flags if they think they've seen a foul as a way to catch the referee's attention.
Flags are also used by linesmen to signal when an attacking player is in an offside position. Linesmen always stay level with the last defender of the team in their respective half of the field in order to be in the best position to make that call.