Why does hair transplant work? Is it not the location on the scalp that doesn't support hair growth?

Multiple factors. In actuality it is more the genetics of the donor site that will determine the fate of the hair but a multitude of other factors both local at the recipient sit as well as systemic influences will effect the survival and growth of the transplanted hair.
Donor site dominance. Good question. Actually, it's the opposite of what you may think. It's where the hair comes from, not where you put it, that determines it's fate. That's why we use hair from the back of the scalp. In most patterns of baldness, the follicles in that area are resistant to the mechanism leading to hair loss.
The hair follicle. Certain hair follicles on the scalp are genetically programmed to not fall out. Even in severe baldness, the hair around the back of the head (occiput) does not fall out. This is the hair which can be removed and transplanted. You can lose 20, 000 + hairs on top of your head, but only harvest around 8, 000 for grafts. Artistic placement of the grafts maximizes results.
No, the hair shaft. It's not the scalp in that location, but the hair follicles in that region, if you move more active follicles to a healthy region they will grow.