Space fleets were generally organized into hierarchical groups for specific strategic purposes. Vessels could operate in those groupings in various situations either permanently or over a short period of time.
Unit
Ships of the same type were referred to as units. Starfleet used several destroyer units during Operation Return. (DS9: "Sacrifice of Angels")
Squadron
Squadrons were a small group of generally three to five ships. Although the exact number of vessels could vary, a Klingon squadron of Birds-of-Prey consisted of five ships , whereas a squadron of Jem'Hadar attack ships usually was comprised of three. (DS9: "Once More Unto the Breach", "The Jem'Hadar")
Starfleet only organized small ships like their attack fighter in squadrons. (DS9: "Sacrifice of Angels", "What You Leave Behind")
Wing
A wing was a grouping of several ships for a specific purpose. Depending on the military, a wing could consist of a different number of ships. Usually, wings were named by the specific mission type. The UFP Starfleet used attack wings and tactical wings. The command of a permanent wing such as the seventh tactical wing required an officer superior to the rank of captain in command, other non-permanent wings such as cruiser or Galaxy-wings could also be commanded by a captain. (DS9: "Sacrifice of Angels", "Behind the Lines")
In the Klingon Defense Force an attack wing consisted of at least seven Birds-of-Prey and two capital ships, mostly Vor'cha-class. (DS9: "Tears of the Prophets")
Battle group
Battle groups consisted of an arbitrary number of ships, usually gathered temporary for a single mission that mostly involved combat. Starfleet assembled a small battle group to assist the USS Enterprise-E during a Reman incursion. (Star Trek Nemesis)
General Martok of the Klingon Empire organized a fleet of 1,500 ships into small battle groups for hit-and-run attacks against the Dominion. (DS9: "When It Rains...")
Task force
A task force was a fleet of ships for a special task such as assault, protection or diplomacy and was generally bigger than the relatively small battle group. Like the battle group, the number of ships in a task force could vary greatly: There were small task forces consisting of only nine ships and large ones consisting of several hundred. (DS9: "Improbable Cause", "Sacrifice of Angels")
In Starfleet, a task force was usually commanded by an admiral, or in some cases a captain. (TNG: "Descent", "Redemption II")
Numbered fleet
Starfleet organized all ships in numbered fleets. A numbered fleet consisted of several hundred ships, all localized in a specific region of space. There were at least nine numbered fleets operating in Starfleet. (DS9: "Favor the Bold")
The Cardassian military used the term "order" rather than "fleet".
Admiralty
In the 18th century, the Admiralty was the highest authority responsible for all naval operations; this term was used to describe all ships and vessels in a space fleet.
In Starfleet this authority was known as Starfleet Command and Commander-in-Chief. (Star Trek VI: The Undiscovered Country)
The Cardassian military took its orders from the Cardassian Central Command, while the highest military authority within the Dominion were the Founders.