The surfer nearest the breaking curl has priority. One wave, one rider.
Priority is how a crowded lineup shares waves without chaos. If someone is deeper than you — closer to where the wave is breaking — it's their wave. Pull back, and your turn comes.