Ships were out at sea for quite a while at times, often not meeting other friendly ships for the entire duration of their voyage. If an admiral were to issue an order to a ship, how would that message be delivered? Another ship carrying the message, searching for the ship that has a new order? Or is the messages delivered by birds? Or something entirely different?
Edit: Holy shit guys, my ignorance put us on the front page!
Packet ships. The admirals would send several copies of the orders to the ports that ship would probably visit while underway. If the ship was on blockade then the orders would be delivered directly to the ship as they knew were they were.
This is of course dealing with frigates. Ships of the line would almost never just go out wandering alone. The frigates would have basic itineraries of where they would be and what they would be doing. And there are specific ports that they would be expected to make call in.
Follow-up question: How did naval ships know when a war ended? Like if one country sent out a fleet with orders to attack, but a truce/ceasefire was agreed upon in the meantime?
In addition to some of the excellent answers above, there was also a great degree of autonomy given to a ship captain (especially frigates) that often patrolled or were out on longer, independent missions away from fleet or convoy action.
They were given specific sets of orders, given specific geographic locations to confine their actions, and were basically taught to use their judgement and assessment of a situation to determine if action was needed.
At sea, in small skirmishes or harassment of enemy supply lines, taking vessels was extremely common (especially given the prize money involved). When captains had to hold an area, or provide coastal support to a landing, it was up to their discretion to evaluate danger, and remain on-station as long as possible.
Orders for long-term action at sea (periods ranging from 6 months to a year in length with only periodic resupply), were extremely general and broad. This is one reason why Captains have sweeping authority over their vessels today, even in modern maritime law. They were literally judge and jury in cases of mistreatment, crime, mutiny, disobedience, incompetence, etc.
The principle of "act first, ask questions later" was well established, as captains would face responsibility for their actions upon return to base. Failure to take appropriate action was taken out on the captain, and many were held accountable for failures.
EDIT: Not Horatio Nelson. Sorry to get you all excited for another sensational story. Admiral John Byng was famously executed for "failing to do his utmost" when tasked with relieving a siege on a British garrison at the Battle of Minorca in the Seven Years War. He moved his fleet into position, but failed to sink any French ships, and took substantial losses without engaging his own ship in the action. Although a different rank than a captain, and responsible for more than one ship, Byng was made an example of for failing to carry out his orders. It's one thing to fail at resupplying a garrison; it's another when you flee combat after a poorly initiated engagement, and fail to carry out your orders. Coincidentally, Byng's execution was even satirized by Voltaire in Candide. He was the last such senior officer subjected to capital punishment that I know of.
Also, minorly awkward, but my flair has disappeared. Whoops.
A question on naval command & control: on voyages far away from friendly ports (e.g., a British fleet is asked to go to New Zealand), how does the government ensure the loyalty of the captain and the officers? What's to stop a rogue captain to go "eh" and defect, or use the fleet to his own ends (e.g., piracy, or just go bombarding some hapless native settlements and looting it)?
Follow-up: Didn't flag codes contribute to quickly sending messages between ships? Were these used for orders during battle or just for, for lack of a better word, "status updates"?
What about birds? They carried messages as well, I assume.