They do that somtimes when they're in season (most of my does do this ALOT when they're in season), could just be happy like when they rub against the fence, or sometimes flies could be irritating them. It's very normal. My goats like to be rubbed under their neck, shoulders, and back mostly.
My girls will wag their tails while on the milkstand waiting for food, when they are happy to see me and even when they are just shooing flies and razzing the boys. Most of mine love an ear scratch, though 2 won't let me touch the ears, they all love the all over brushings and the rub under the chin.
She never wags her tail, but 180+lb Mystify waddles up, leans into me & asks for all over massage.
Her sister only needs to rub her cheek all over my face & neck. Others only need a few short strokes, while one demands deep scratching in the indentation right behind her horns.
My goats have their own spot they like to be rubbed. They wag their tails at flies, bottle babies wag it when they see me, dam raised kids wag their little tails when they nurse, My adults wag them when they are happy/contented. One of my does, when pregnant loves her shoulders/ withers scratched and when I do she leans on my with her eyes half closed.
Nigerian Dwarf Dairy Goats, assorted poultry and two LGDs an Anatolian and Great pyr pup
My wether seems to wag his tail the most when he is being ornery or playful. The girls do it when they are coming into heat and also when they wanna play. They all do it when they're being bothered by bugs.
Most goats like being petted around the neck, chest, and shoulders...but certain individuals have specific areas where they like being rubbed or scratched.