The principle of smooth fit is probably the most used tool to find solutions to optimal stopping problems of one-dimensional diffusions. It is important, e.g., in financial mathematical applications to understand in which kind of models and problems smooth fit can fail. In this paper we connect-in case of one-dimensional diffusions-the validity of smooth fit and the differentiability of excessive functions. The basic tool to derive the results is the representation theory of excessive functions; in particular, the Riesz and Martin representations. It is seen that the differentiability may not hold in case the speed measure of the diffusion or the representing measure of the excessive function has atoms. As an example, we study optimal stopping of sticky Brownian motion. It is known that the validity of the smooth fit in this case depends on the value of the discounting parameter (when the other parameters are fixed). We decompose the size of the jump in the derivative of the value function into two factors. The first one is due to the atom of the representing measure and the second one due to the atom of the speed measure.