This was bugging me for ever.
Every now and then my Dock would appear at the bottom of one of my external displays. And to get it back I’d have to open up System Preferences and drag it back. Very time-consuming.
Eventually I figured it was a Mac bug.
However, it seems you can summon the Dock to a display by moving your mouse down at the bottom of that display. Which is what I must have inadvertently been doing.