Short answer: open System Settings, choose Desktop & Dock, and set Position on screen to Bottom.
Or paste defaults write com.apple.dock orientation -string bottom; killall Dock into Terminal.
On macOS 12 and earlier the panel is called Dock & Menu Bar in System Preferences. The setting is the same.
This does the same thing and also works when the settings panel will not open:
defaults write com.apple.dock orientation -string bottom; killall Dock
The first half stores the edge, the second restarts the Dock so it appears there. To see which edge it is on right now, run defaults read com.apple.dock orientation. It answers left, bottom or right. If it says the key does not exist, the Dock is on the default edge, which is the bottom.
Two common causes. The first is a slip of the mouse: dragging the divider while holding Shift moves the Dock to another edge, and a few people hold Shift without noticing. The second is another app or a setup script writing the orientation key. If it keeps coming back, see why the Dock resets itself.
With more than one display, the Dock appears on the screen where you last pushed the pointer against the bottom edge. Move the pointer to the bottom edge of the display you want and keep it there for a moment. The Dock follows. This is by design, and there is no setting that pins it to one display in System Settings. The built-in workarounds and what each costs are in how to keep the Mac Dock on one screen.
On current macOS the Dock sits a little above the bottom edge of the screen, with a gap under it. That is how it is drawn and nothing is wrong. If it is floating in the middle of the left or right edge instead, it is on the side: use the steps above.
If the Dock has gone entirely, start with my Mac's Dock disappeared.
Once the Dock is at the bottom, lock the position so a slip of the mouse or another app cannot move it:
defaults write com.apple.dock position-immutable -bool true; killall Dock
Swap true for false to release it. The other three locks are in the Terminal guide. Still Dock does the same from a switch in the menu bar, and also holds the size, the contents and auto-hide. Locking the size is free.
No. macOS has only ever supported the left, bottom and right edges, and the orientation key accepts nothing else.
No. killall Dock restarts the Dock, which is all the change needs.
No. Position is a separate setting. Your apps, size and folders stay as they are.