I know that in ancient times ships could not sail on open sea for a long time and had to sail near coast to resupply.
So first question, when did this change?
Second question: how were navies able to find and engage in battle another navies in the big open space, that are oceans?
Most naval battles historically have been fought near land, for the reason that naval power has historically been auxiliary to land power -- navies fight for command of the sea for a lot of reasons, but the main ones are to help their nation-states project power overseas or deny enemies access to resources. In the Napoleonic period, two of the most famous battles of the time (the Nile and Copenhagen) were actually fought between an attacking British fleet and a fleet at anchor; Trafalgar was the result of a long chase of the French fleet across the Atlantic and back, resulting in an encounter off Cape Trafalgar where the Atlantic coast is starting to narrow towards the Straits of Gibraltar. The only noticeable action fought out of the sight of land was the Glorious First of June, when the British and French fleets engaged one another about 400 miles west of Ushant; in that case the British fleet had been chasing a French fleet that was protecting a grain convoy. Ships follow predictable routes, particularly in the age of sail, and there are notable choke points that navies can use to lie in wait for an opponent or to scout.
But that doesn't answer your question, which is how fleets found one another. One thing to know about the ocean is that it's flat (compared to land; of course there are waves on it). If you're up a mast say 150 feet or so, you can scan the horizon out to 15 miles or so; if you have a line of ships say 10 miles apart, you can cover a significant visual distance, more so because ships themselves have tall masts that may be visible well before they are "hull up" over the curve of the earth.
I wrote more about this here, where I discuss a fleet blockade; and here about Trafalgar.
Relatively few battles were fought in the open ocean. It's nearly impossible, before aircraft and radar, to find another ship. Even from high on the mast, your limited by the curvature of the Earth to about 10 miles, depending on the hight of your mast, the hight of their mast, and how much sail they have set. And entire fleets have passed each other in the night.
There's a reason many battles are named after nearby land, like "Second Battle of Algeciras" or "The Battle of the Nile". Ships have to put into ports, and they can be found there. Nelson had scouting ships all over the Mediterranean until they located the French in Egypt. The British maintained, at great expense, blockades of French, Spanish, or American ports to prevent ships from reaching the open ocean. Other likely spots are area of restricted movement, such as around the English Channel.
There are exceptions, of course. In the battle known as The Glorious First of June, Admiral Lord Howe spread his ships on a long line, just within sight of each other. This partially worked, in that he was able to find the French battlefleet and engage them, but the grain convoy was able to slip through.
Just a brief addition: In the age of sail a lot of naval battles were delayed—sometimes indefinitely—by the sheer difficulty of coordinating two separate fleets into battle with each other. Tides, wind, weather, depth all have to cooperate—even when actually seeking battle a fleet could be trapped in a harbor, scattered by a storm, partially beached, blown away from combat, etc. An important corollary is that in a sail naval battle you don’t just want to engage, you want to engage when you have the all-important weather gage—ie wind on your side. You might also be worried about factors like your potential avenue of retreat, proximity to dangerous coastal obstacles or enemy shore forts etc etc. One fleet might be in hostile waters and thus maybe lack reliable depth charts and pilots, leading to further hesitation. And all the while, if your fleet is not directly adjacent to a friendly port, your supplies are running out and the risk of disease is increasing. A lot of age of sail naval battles thus involved a whole lot of faffing about beforehand and many never actually resulted in proper action thanks to the challenges inherent to that era of nautical technology.
In short, just finding the enemy is only part of the problem the ocean environment presents. From there one or both fleets have to be willing and able to engage, which can be a real challenge.
You folks keep mentioning scouting ships. How would a scouting ship have any hope of rapidly reporting anything to a fleet? Is this just to say that the fleet spread out into a wide band? Or that the main fleet might be anchored somewhere, and then smaller ships would show up as the wind allowed and report “Saw 4 very large boats headed west 2 weeks ago”?
I guess the notion suggests that fleets were spread wide, and convergent forces might be fairly organic, like, “Captain Jones is Scheduled to be on that island this week, swing by and check. If not there, leave a note that we are chasing the spanish westward, and he should try and catchup”
I guess it breaks down to “how many ports” “is there any motivation to visit that port” “how fast can a boat go” and “how many boats can we schedule to synchronize”
I know there are trade winds… I guess I want to see an animated map outlying 100 years of sea traffic, the available wars, and the trade winds. This would fill in the notion of “were sea battles predictably consistent in season and local”
(Sorry for the stream of thought, guess I need to take up naval battle lore)