Recursion can be a bit difficult to understand at first. This visualization shows how mergesort([3,2,7,1,4,6,5]) repeatedly splits the problem into sub-problems until a sub-problem is sorted, and then recombines the result of two sub-problems using merge() before it returns:
The final result is:
Visualization made using invocation-tree, I'm the developer. (remove this line if considered self promotion)