Back in the day of the British Empire, it was said that the sun shall not set on the British Empire. In order to ensure this, the tradition of the Sunset Ceremony was started.
Generally, the ceremony takes place just before the actual sun sets; however, this is not always the case. For example, in Arctic areas, the sun will set for months at a time, and rise for months at a time. Therefore, a time is set for the lowering of the flag even though the sun is still up or down.
At a military establishment, whether it be a ship or a base, a warning is given at five minutes and one minute prior to the ceremony. During the ceremony, everybody in the vicinity of the flags is expected to stand at attention and salute the lowering flag. Depending on the location, the ceremony may be accompanied by the sounding of a bugle, a bosun's call, or a band.
As tattoos tend to occur during the evening, sunset ceremonies are generally included in the celebrations.
In the morning, the opposite ceremony is performed, called Morning Colours, which is the raising of the flag.