Battle of Trafalgar
Fleets: 

British: On 21 October, Admiral Nelson had 27 ships of the line with  2148 cannons, and a total of  17000 crewmen and marines under his command. Nelson's flagship, HMS Victory, captained by Thomas Masterman Hardy, was one of three 100 gun first-rates in his fleet. He also had four 98 gun second-rates and 20 third-rates. One of the third-rates was an 80 gun vessel, and 16 were 74 gun vessels. The remaining three were 64 gun ships, which were being phased out of the Royal Navy at the time of the battle. Nelson also had four frigates of 38 or 36 guns, a 12 gun schooner and a 10 gun cutter.

Franco-Spanish: Against Nelson, Vice-Admiral Villeneuve, sailing on his flagship Bucentaure, fielded 33 ships of the line, including some of the largest in the world at the time. The Spanish contributed four first-rates to the fleet – three of these ships, one at 130 guns (Santísima Trinidad) and two at 112 guns (Príncipe de Asturias, Santa Ana), were much larger than anything under Nelson's command. The fourth first-rate carried 100 guns. The fleet had six 80 gun third-rates, (four French and two Spanish), and one Spanish 64 gun third-rate. The remaining 22 third-rates were 74 gun vessels, of which 14 were French and eight Spanish. In total, the Spanish contributed 15 ships of the line and the French 18 along with some  30000 men and marines manning  2632 cannons. The fleet also included five 40 gun frigates and two 18 gun brigs, all French.

Battle: 

Nelson's plan: The prevailing tactical orthodoxy at the time involved manoeuvring to approach the enemy fleet in a single line of battle and then engaging broadside in parallel lines. In previous times, fleets had usually engaged in a mixed mêlée of chaotic one-on-one battles. One reason for the development of the line of battle formation was to facilitate control of the fleet: if all the ships were in line, signalling during battle became possible. The line also allowed either side to disengage by breaking away in formation; if the opponent chose to continue, their line would be broken as well. This often led to inconclusive battles, or allowed the losing side to minimise its losses. Facing a numerically superior Franco-Spanish line, Nelson wanted to break it into a chaotic mêlée which would force the enemy to fight his well-trained crews ship to ship.
Nelson's solution was to cut the opposing line in three. Approaching in two columns sailing perpendicular to the enemy's line, one towards the centre of the opposing line and one towards the trailing end, his ships would surround the middle third, and force them to fight to the end. Nelson hoped specifically to cut the line just in front of the French flagship, Bucentaure; the isolated ships in front of the break would not be able to see the flagship's signals, which he hoped would take them out of combat while they re-formed. This echoed the tactics used by Admiral Duncan at the Battle of Camperdown and Admiral Jervis at the Battle of Cape St. Vincent, both in 1797.

The plan had three principal advantages:

First, the British fleet would close with the Franco-Spanish as quickly as possible, preventing their escape.
Second, it would quickly bring on a mêlée and frantic battle by breaking the Franco-Spanish line and inducing a series of individual ship-to-ship actions, in which the British knew they were likely to prevail. Nelson knew that the superior seamanship, faster gunnery and better morale of his crews were great advantages.
Third, it would bring a decisive concentration on the rear of the Franco-Spanish fleet. The ships in the van of the enemy fleet would have to turn back to support the rear, which would take a long time. Additionally, once the Franco-Spanish line had been broken, their ships would be relatively defenceless against powerful broadsides from the British fleet, and it would take them a long time to reposition to return fire.
The main drawback of attacking head-on was that as the leading British ships approached, the Franco-Spanish Combined Fleet would be able to direct raking broadside fire at their bows, to which they would be unable to reply. To lessen the time the fleet was exposed to this danger, Nelson had his ships make all available sail (including stunsails), yet another departure from the norm. He was also well aware that French and Spanish gunners were ill-trained and would have difficulty firing accurately from a moving gun platform. The Combined Fleet was sailing across a heavy swell, causing the ships to roll heavily and exacerbate the problem. Nelson's plan was a carefully calculated gamble.
During the blockade off the coast of Spain in October, Nelson instructed his captains, over two dinners aboard Victory, on his plan for the approaching battle. In an animated conversation with his favourite captain, Richard Goodwin Keats, who was expected to be his second in the forthcoming battle, Nelson explained a refined battle plan whilst the two were walking in the garden of Merton in August 1805. The order of sailing, in which the fleet was arranged when the enemy was first sighted, was to be the order of the ensuing action so that no time would be wasted in forming two lines. The first, led by his second-in-command Vice-Admiral Cuthbert Collingwood, was to sail into the rear of the enemy line, while the other, led by Nelson, was to sail into the centre and vanguard. In preparation for the battle, Nelson ordered the ships of his fleet to be painted in a distinctive yellow and black pattern (later known as the Nelson Chequer) that would make them easy to distinguish from their opponents.
Nelson was careful to point out that something had to be left to chance. Nothing is sure in a sea battle, so he left his captains free from all hampering rules by telling them that "No captain can do very wrong if he places his ship alongside that of the enemy." In short, circumstances would dictate the execution, subject to the guiding rule that the enemy's rear was to be cut off and superior force concentrated on that part of the enemy's line.
Admiral Villeneuve himself expressed his belief that Nelson would use some sort of unorthodox attack, presciently speculating that Nelson would drive right at his line. But his long game of cat and mouse with Nelson had worn him down, and he was suffering from a loss of nerve. Fearing that his inexperienced officers would be unable to maintain formation in more than one group, he chose to keep the single line that became Nelson's target.

Departure: The Combined Fleet of French and Spanish warships anchored in Cádiz under the leadership of Admiral Villeneuve was in disarray. On 16 September 1805 Villeneuve received orders from Napoleon to sail the Combined Fleet from Cádiz to Naples. At first, Villeneuve was optimistic about returning to the Mediterranean, but soon had second thoughts. A war council was held aboard his flagship, Bucentaure, on 8 October. While some of the French captains wished to obey Napoleon's orders, the Spanish captains and other French officers, including Villeneuve, thought it best to remain in Cádiz. Villeneuve changed his mind yet again on 18 October 1805, ordering the Combined Fleet to sail immediately even though there were only very light winds.
The sudden change was prompted by a letter Villeneuve had received on 18 October, informing him that Vice-Admiral François Rosily had arrived in Madrid with orders to take command of the Combined Fleet. Stung by the prospect of being disgraced before the fleet, Villeneuve resolved to go to sea before his successor could reach Cádiz. At the same time, he received intelligence that a detachment of six British ships (Admiral Louis' squadron), had docked at Gibraltar, thus weakening the British fleet. This was used as the pretext for sudden change.
The weather, however, suddenly turned calm following a week of gales. This slowed the progress of the fleet leaving the harbour, giving the British plenty of warning. Villeneuve had drawn up plans to form a force of four squadrons, each containing both French and Spanish ships. Following their earlier vote on 8 October to stay put, some captains were reluctant to leave Cádiz, and as a result they failed to follow Villeneuve's orders closely and the fleet straggled out of the harbour in no particular formation.
It took most of 20 October for Villeneuve to get his fleet organised; it eventually set sail in three columns for the Straits of Gibraltar to the southeast. That same evening, Achille spotted a force of 18 British ships of the line in pursuit. The fleet began to prepare for battle and during the night, they were ordered into a single line. The following day, Nelson's fleet of 27 ships of the line and four frigates was spotted in pursuit from the northwest with the wind behind it. Villeneuve again ordered his fleet into three columns, but soon changed his mind and restored a single line. The result was a sprawling, uneven formation.