How are two sorted sequences merged into one, and why does that take only $O(n)$ time?
Compare the first elements of both sequences, move the smaller one to the end of the output, and repeat; when one sequence runs empty, append the rest of the other. Every comparison places one element, so merging $n$ elements takes at most $n - 1$ comparisons: $O(n)$.
* The output grows strictly from the left: the next element is always one of the two fronts. *
Because both inputs are sorted, the smallest element not yet placed must sit at the front of $A$ or at the front of $B$: everything behind a front is at least as large as that front. So one comparison of the two fronts finds the next output element, and nothing else has to be looked at.
Algorithm merge(A, B)
S ← empty sequence
while ¬A.isEmpty() ∧ ¬B.isEmpty()
if A.first() ≤ B.first() // ≤ keeps the sort stable
S.insertLast(A.removeFirst())
else
S.insertLast(B.removeFirst())
append what is left of A, then what is left of B
return S
Each loop step does $O(1)$ work, as long as removing at the front and appending at the back are $O(1)$. That holds for a doubly linked list, and for arrays that only pretend to be sequences: an index ai points at the current front of $A$, bi at the front of $B$ and si at the next free slot of $S$, so "remove the first element" becomes ai++ and "insert last" becomes S[si++] = …. Merging 2 4 7 9 with 1 3 6 8 takes 7 comparisons; the eighth element, 9, is copied without one because $B$ is already empty.
Go deeper:
Merge algorithm — merging two lists, k-way merging and its use outside sorting.