Flags!

While flags and other signals have been used throughout history, beginning in the 17th century there was a movement to standardize their use and link individual flags to letters and numbers, so that extensive messages as well as standard signals could be sent.
The way it usually worked is that you’d have a lookout on the crow’s nest of each ship who would look out for the signals of other ships and shout or run the message down to the deck, and then some of the crew manning the ropes who would send up particular sequences of flags when ordered to. While each ship could obviously send and receive information on its own, generally the rule was that the flagship (and yes, that’s where the name comes from) would initiate orders and then ships would re-broadcast that message out to the rest of the fleet, and then other ships would send back updates, warnings, requests, etc. to the flagship.