What triggers it
With allow-flight=false, the default, the server kicks a player who hovers for several seconds while not in creative or spectator mode. Lag can cause it, as can mods and plugins that let players fly legitimately: jetpacks, flight rings, plugins with a fly command, or riding certain modded entities.
When to set allow-flight=true
On modded servers with flying items, on plugin servers where staff or ranks can fly, and on servers where lag causes false kicks, set allow-flight=true. It only disables this one vanilla check; it does not let anyone fly on their own.
Use an anti-cheat instead
The vanilla check is crude and easy to bypass. On a public server, set allow-flight=true and let a proper anti-cheat, such as Grim, handle flight detection. It understands legitimate movement much better and gives staff alerts instead of instant kicks.