Right-click on the bar and check that 'Lock the Taskbar' does NOT have a tick alongside it. (If it has, click to get rid of the tick).
Then simply 'drag-and-drop' the bar (Using your mouse with the left-hand button held down) to put it back where it belongs. (It often takes several attempts!).
Then right-click and put a tick against 'Lock the Taskbar', so that it doesn't wander again.