I have been reading and watching videos about local and global extrema, but all of this material covers the topic just graphically, and nobody really explicitly cares on how to find the global maximum or global minimum of a function numerically (or mathematically), or what is the advisable process to find it, and what are the constraints, etc.
For this reason, I have been thinking and reading that one way to find the global maximum and minimum is to find respectively all the local (in the interior of the function) maximum and minimum, using for example the first derivative test or second derivative test, and then pick the largest or smallest respectively between them and compare them with the extreme points of the function, and pick them eventually if they are greater or smaller respectively to the greatest local maximum and smallest local minimum.
Now, it appears that the function must be continuous on a closed interval. Is this true for all cases? If yes, why?
Is in general the process that I have described what you mathematicians usually do by hand?
Are there any (simple) alternatives?