This question has two slightly different answers depending upon the type of interval involved. If you are talking about a closed endpoint like #[a,b]# which includes the endpoints, then we must include those points as possible points where the maximum and minimum value could occur. This is usually done using what is called the "candidates test."
If you are talking about an open interval like #(a,b)# where the endpoints are not included, then you need to use the first or second derivative test, but you also need to consider the "global question" of whether the points you found are absolute extrema or merely relative extrema.
We shall begin with the first case. Find the derivative of the function, #f'(x)#. Next find the critical values for the derivative (points in the domain of the function where the derivative is equal to zero or undefined. Your "candidates" for possible absolute extrema are the endpoints of the interval (#x=a# and #x=b#) and any critical values you found. Find the #y# value of the function at each of these points. The absolute maximum is the greatest of these values, while the actual minimum is the least.
Things become a bit more hazy on an open interval, as there are some functions that may have no maximum and/or minimum (e.g., #y=x# has neither on #(-oo,oo)#). Here we again find #f'(x)# and find the critical values. Next we can use the first derivative test, which says that: 1) If the first derivative switches from positive to negative at #x=c#, then there is a relative maximum (the #y# value) at #c#, and 2) If the first derivative switches from negative to positive at #x=c# then there is a relative minimum (the #y# value) at #c#.
However, there is one final step. Sometimes, a relative extrema is not an absolute extreme value. We must look at the "global picture" to make some sort of argument for our maximum being the absolute maximum (e.g., because the function has no other critical values). Otherwise, we may have just found a relative extreme value.