Senior naval officers are known as Flag Officers. This is because they have the right to fly a special flag at the mast of the ship they are working from. In the Royal Navy during the Napoleonic Wars, admirals were still divided into three divisions – red, white and blue, an obsolete distinction based on the fleet tactics of the mid seventeenth century, when the entire fleet would serve together. The squadron system was finally abolished in 1864, when the entire fleet adopted the white ensign.
Each ship flew the ensign – red, white or blue depending on their squadron. This flag was flown at the flagstaff at the stern of the ship. The ensign had the union flag in the top corner, on the correct coloured background. The admiral’s flag was a simple coloured rectangle. Full admirals flew their flag on the main mast, vice admirals on the fore mast and rear admirals on the mizzen mast (the mast behind the main mast). Every flag officer was a member of one of the squadrons, although they didn’t always fly that colour flag in order to avoid confusion when two admirals of the same colour were serving in the same fleet. Every ship of the line carried flags for all three squadrons (as well as French, Spanish and Dutch flags, just in case!).
When an admiral transferred to a new ship, he was said to have ‘raised his flag’. From that moment he was ‘flying his flag’ on that ship. Thus, when Admiral Collingwood transferred to the Royal Sovereign before the battle of Trafalgar, he was said to have ‘raised his flag’ on her. Later, when he learnt of Nelson's death, Collingwood was able to transfer his flag to the frigage Euryalus, his own ship having been immobalised during the battle. Having 'raised his flag' on the new ship, the rest of the fleet would know where to look for orders.