Optimization is finding which value(s) of x maximize (or minimize) a function f(x).
Given a number x, it's easy to find f(x). If you have two numbers, x1 and x2, you can tell which of f(x1) and f(x2) is bigger. But how can you find x_max, where f(x_max) >= f(x) for all other values for x?
The answer is found in calculus. The intuition is pretty simple. Let's talk mountains instead of functions. Mountains have little peaks and valleys. As you scale a mountain, your elevation rises and falls.
You can feel when you're ascending and when you're descending. You close your eyes. Is it possible to tell when you've reached a peak on the mountain?
The answer is yes, and here's how. Just before you reach the peak, you can feel you are ascending. Just after you step off the peak, you can feel you are descending. In other words, you make a transition from ascending to descending.
Let's relate it back to calculus. The lateral distance (longitude or latitude, your choice) you've traveled across the mountain is x. Your altitude is f(x). The mountain is the graph of the function.
Your eyes being closed is indicative of the fact you only know the value of f where you are standing. (You can't "look" at nearby parts of the mountain for reference... and you don't need to).
Ascending and descending are related to your derivative. When you're ascending, you have a positive derivative. When you're descending, you have a negative derivative.
So the "peak" of a function is when the sign of the derivative changes from positive to negative. And the only way for it to be able to do that is by going from positive to zero to negative. So the first step of looking for maximums is to look for the zeroes of the derivative.
In notation, what you're trying to solve is: f'(x) = 0.
Now, f' (for first and second year calculus) is going to be something simple -- usually a polynomial. Finding the zeroes of a polynomial is the most important topic you learn about in algebra.
Once you find the zeroes of f', you're half way there. You can name the zeroes x1, x2, ..., xN (there might be multiple zeroes, there might be one... sometimes there are none at all).
The next step after finding the zeroes is making sure that you are in fact going from positive to negative. It's entirely possible for a function's derivative to go from negative to positive instead -- in this case, you have found a valley, not a peak (a minimum, not a maximum). You can also have negative to negative and positive to positive, or from zero to zero (these are all different kinds of plateau-ish things).
Up to this point, you're almost done. You've identified all the peaks of your function. But often what you want to find isn't just "any peak", but rather, you want the TALLEST peak. The summit of the mountain. This is usually as easy as comparing all the peaks you found and seeing which is the biggest.
There are some sneaky cases I've glossed over. A function could have multiple summits that are all the same height (sin x has an infinite number of maximums, for example). Other functions have no peaks (f(x) = x^2 only has a valley, but no peaks, f(x) = x^3 has neither). Everything I said above applies only to "well behaved" functions that you'll find in physics classes. (Mathematicians have more precise rules, and they can invent functions which "technically" obey the rules, but break our expectations).
Good luck!