How to avoid temperature being infinite at entropy maximum Learning thermodynamics out of Callen -- which takes a postulate approach. Postulate II is as follows:

There exists a function (called the entropy S) of the extensive parameters  of any composite system, defined for all equilibrium states and having the following property: The values assumed by the extensive parameters in the absence of an internal constraint are those that maximize the entropy over the manifold of constrained equilibrium states.

It is stressed that the existence of the entropy is postulated only for equilibrium states (defined to be states that are macroscopically characterized completely by the internal energy $U$, the volume $V$, and the mole numbers of the chemical components $N_1$, $N_2$, ...).
Let's look at a simple system -- a long cylinder with a fixable piston and gas on one side. There is a set number of particles, so the entropy is a function of only $U$ and $V$. As we move the piston, $V$ changes, and $U$ changes consequently. The space of equilibrium values of $U$ and $V$ plugged in to the entropy function $S$ defines a surface over the $U$-$V$ plane. Postulate II defines the equilibrium state to be the state at which $S$ is a maximum (i.e. the highest point on the $S$-surface).
If we define Temperature in the following way:

$\dfrac{1}{T} = \dfrac{\partial S}{\partial U}$

I'm having trouble understanding how temperature is not infinite in the state at which $U$ and $V$ maximize $S$. If $S$ is maximized, doesn't the derivative of $S$ at the point form a plane parallel to the $U$-$V$ plane? And then, keeping V constant, wouldn't the derivative of $S$ with respect to $U$ necessarily have to be 0?
 A: So you are right and you are wrong.
You are right that there is a class of systems which can attain negative temperature, a situation where $$\left(\frac{\partial S}{\partial U}\right)_{N_i,V}<0$$
and such a system is hotter than any system at finite temperature. In the middle between this and a normal regime the temperature must go from $+\infty$ to $-\infty$ as its temperature increases.
You are wrong in thinking that this is a common situation. Most systems can be extended to larger volumes and energies and our uncertainty about what microscopic state it is in grows out to infinity. These negative-temperature systems require an energy investment which somehow orders the system, while kinetic energy usually makes the system more disordered. And of course these systems cannot last very long while they are in thermal contact with conventional systems as it is a tremendous temperature gradient.
A: The equation $\dfrac{1}{T} = \dfrac{\partial S}{\partial U}$ refers to a differential relationship among equilibrium states described by functions of $U,V, T, S, N_1, N_2, etc.$. These functions assume a fixed set of constraints, for a different set of constraints we have other functions. But note that the variables $U, V, S, T, N_1, N_2, ...$ make sense irrespective of the constraints and the functional relationship among them, therefore when some of the constraints change and a new equilibrium sets in we can have a different new value of say, $S$ that now is larger than what was before, one that is in fact maximum relative to all virtual displacement of the other variables but consistent with the constraints and having constant $U$.
A: Callen speaks of a composite system. Your stated example is not detailed enough for one to decide whether you have a composite system in mind. If the cylinder is not insulated, then you have the composite system of cylinder+surroundings, and $U,V$ of the entire composite system needs to be considered, not just that of cylinder alone. If the cylinder is insulated, then doing work on the gas changes its $U,V$ in general. Its $S$ is then given by the fundamental relation $S=f(U,V)$ specific to that gas. The question of entropy maximization does not arise in this case, because for a given $U,V$ of the gas, there can be only one unique value for $S$.
A: Actual infinities don't generally obtain in physics. Hence temperature is never actually infinity, it can merely approach infinity. 
And this means the rate of change of entropy wrt (internal) energy is never zero. 
And this in turn means that the maximal entropy is never reached. 
Physically this makes sense. For example, what is the maximum entropy of the entire universe? 
