The anal glands are located on either side if your dog's anus, at about 4 and 8 o'clock. They normally squirt a little foul-smelling (to us) fluid every time your dog poops - for scent-marking purposes. Your dog will let you know if they need to be expressed - he will scoot on your rug or lick and bite his anus. You can sometimes tell if they need to be done by tapping around the anus and you can feel the full anal glands, but they can be sensitive, so be careful. Some dogs need them expressed once in a while, some never, some regularly. It's not good to do it preventitively on a regular basis, because it can irritate the area and make it worse.

Here's how to do it if you so desire. Have someone hold your dog's head, be careful if he's a biter, that area can be sensitive on a good day. Put on a rubber glove. If you fail to take this step, you may find it necessary to amputate your finger, or even your entire hand, as the smell doesn't come out. If you have a bio-hazard suit with a facemask, all the better.
Put a little Vaseline on your dominant index finger, and insert into anus, up to the second joint. Hold a paper towel on the outside to catch any squirting. With your thumb on the outside, gently pinch the area, the full anal glands will feel like a bump under the skin - pea to marble size. Gently but firmly, squeeze the gland from front to back. If nothing comes out, bend your finger a bit, sometimes it is covering the duct. DO NOT, I repeat, DO NOT put your face near the anus to see what's going on. Trust me on that one.

After it squirts out, do it a couple of times to ensure you got it all. Doing the second one can be a little difficult. I'm right-handed, so it's easy to do the left one, but I have to turn my hand around awkwardly to do the second.

When you're done, put your dog outside for a while, and he will clean himself up. Ick.

Anal glands can be removed, but it's a nasty surgery because of its location - hard to keep clean.

When I was a vet tech, I showed quite a few clients how to do it, so they didn't have to keep coming in. Every single one tried it exactly once.

It is not the critic who counts: not the man who points out how the strong man stumbles or where the doer of deeds could have done better. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood, who strives valiantly, who errs and comes up short again and again, because there is no effort without error or shortcoming, but who knows the great enthusiasms, the great devotions, who spends himself for a worthy cause; who, at the best, knows, in the end, the triumph of high achievement, and who, at the worst, if he fails, at least he fails while daring greatly, so that his place shall never be with those cold and timid souls who knew neither victory nor defeat."

Theodore Roosevelt