A dogs anal glands that function properly are there for lubricating the stool during a bowel movement and for scent identification among other dogs. This explains why dogs like to sniff butts apon meeting as well as sniff discarded poop found while out for a walk.
Should a dogs anal glands be expressed routinely? The short answere is no, if it aint broke don't fix it. However, If a dog exhibits the behaviour associated with a full anal sack, such as scooting on the floor, licking the area obsessively, or releasing them at inappropriate times, such as while sitting in your lap, then the answere is a definite yes.
The opening to the anal sack is a very tiney opening about the size of a pin hole. If the fluid inside becomes thick enough, it can block the opening. If left unattended to, the gland can become very painful and infected, requiring medical intervention by a qualified veterinarian who may prescribe antibiotics, a change of diet and sometimes surgery if an abscess has formed.
If your dog consistantly has the symptoms of a full anal gland then it is definitely reqiuired to express them on a regular basis to eliminate future problems.