Why do we evaluate the gravitational potential energy relative to the middle of the rod? 
Here is the diagram for the problem and the question is asking me to find the angular velocity of the rod when it is completely vertical. I used the conservation of energy but I was wondering why I have to choose (l/2) as the maximum height for PE and not use $MgL$. What I was thinking is that since it is $L$ higher than its initial position that means the height is $L$.
 A: It is a shortcut that is usually derived once in introductory physics classes, but as usual the derivation is forgotten but the concept sticks.
If you have your rod in a uniform, vertical field, each mass element $\text dm$ has a potential energy of $\text dU=gy\,\text dm$, where $g$ is the acceleration due to the field and $y$ is the vertical height of the mass element (where, as usual, where $y=0$ can be set anywhere). Then, for a vertical rod of uniform density $\lambda=\text dm/\text dy=M/L$ whose base is at $y=y_0$, the total potential energy of the rod is
$$U_\text{vertical}=\int\text dU=\int_{y_0}^{y_0+L}\lambda gy\,\text dy=
\frac12\lambda g\left[(y_0+L)^2-y_0^2\right]=\frac12MgL+Mgy_0$$
For the horizontal rod located at $y=y_0+L$, the potential energy is a lot easier to determine since all parts of the rod are at the same height; it is just $U_\text{horizontal}=Mg(y_0+L)$ (you could set up another integral for this if you wanted to). Therefore, the change in potential energy from horizontal to vertical is
$$\Delta U=U_\text{vertical}-U_\text{horizontal}=\frac12MgL+Mgy_0-Mg(y_0+L)=-Mg\frac L2$$
which is what is used in the problem.
A: When dealing with rotational dynamics and extended objects, we consider the motion and position of the centre of mass, COM. Remember that in classical mechanics, the position of an extended object is considered to be the location of its COM - the position of this is given by $\frac{L}{2}$ here (assuming the rod is of constant mass density).
This means that the potential energy of the rod will be given by $Mg\frac{L}{2}$. Note that you are also calculating the rod's rotational kinetic energy $$KE_{R} = \frac{1}{2}I\omega^2=Mg\frac{L}{2}$$
where $\omega$ is the rod's angular velocity of the point defined by $\frac{L}{2}$, meaning you need to know the PE of the COM of the rod initially, that causes this $KE_R$ of the COM as it passes through its equilibrium position labelled "CM".
