This is a pretty broad question...
To me, the main thing about dogs and territory is that they are not very good judges of what really is their territory. They bark at people going by on the sidewalk. They bark at other dogs when they are riding in a car. It's as if they think that anything they can see is their territory.
It is triggered whenever an intruder enters the territory of those dogs.
The defender faces the intruder barking, then growls, it has shaggy hair and tail and ears are erected, it stops at a distance of a few feet away the intruder and it sets its eyes on intruder (phase of intimidation). If the intruder remains, the defender scratches on the ground with all four paws, and, after all, if the intruder does not leave, it is attacked.
At home, an overprotective dog will prevent any foreign entry, taking the same attitude described above.