Earlier quoted context omitted.
The second derivative notation makes sense when you think of d/dx as an operator on functions. (As someone noted below, d/dx is essentially a tangent vector, which is something that operates on functions.) d/dx takes the derivative of what follows with respect to x, so (d/dx)(f) = df/dx is the derivative function of f with respect to x. Now you want to differentiate df/dx with respect to x, so you do "d/dx" to "df/dx…
The problem is that d/dx(dy/dx) is not d^2 y/(dx)^2. d/dx (dy/dx) is really d(dy/dx)/dx, which is ((d^2 y)/dx + dy d(1/dx))/dx = d^2 y/dx - dy/dx (d^2 x)/(dx)^2, where df is the actual differential.
I meant to explain why the notation "d^2 f/dx^2" is the way it is. It looks funny, and students would often ask why the 2's were "in different places". But it makes sense when you remember that "d/dx" is the derivative operator.