As far as I can tell, cows will be milked regardless of whether they are chained, caged, or free-roaming. The milker will go and grab the cow, wherever it is, and then drag it to the farmer's workshop. After milking the cow will be let loose. If it was assigned to a chain or cage another dwarf will presently come along and put it back where it was assigned to go.
I have run successful dairy farms in several fortresses now. The method I use is to make a small room off to one side of the main fortress containing one built cage, a few chains, and a farmer's workshop. I put all the cows and calves in the cage. Bulls go on the chains, and all but the best one or two bulls get butchered the moment they mature. The cow room is connected to the main fortress by a single tile wide corridor with multiple door set to be dwarf-accessible but pet-impassible. Just outside that I have stockpiles for buckets and milk, and a second farmer's workshop where cheese is made.
Every now and then I set the farmer's workshop to milk cows. A dwarf will go and get a cow from the cage and milk it. The cow is released afterward but can't get very far because of the pet-impassible doors. While out of its cage it can get pregnant however, and will then give birth after being put back in the cage. All calves, as soon as they are born, get assigned to that same cage. Bulls, when they mature, get assigned to one of the chains, and then butchered if I have already have better bulls chained up. I try to breed them for size and amount of muscle.
The milk later gets made into cheese, which is then combined with turtle and plump helmets to make roasts.