Most people interested in machines know that adding a slight crown to a pulley tends to keep flat belts centered. But it is not obvious how it works.
As shown in the sketch above, introduction of a slight crown to the pulley causes the belt to bend when it is displaced laterally. Consider a point on the belt which comes into contact with the pulley at point and sticks. Once it sticks to the pulley, it travels perpendicular to the axis of rotation of the pulley, coming to the point after one quarter of a revolution of the pulley. The belt has now moved to the position indicated by the dashed lines. Based on this argument, we see that a belt tends to climb the surface of a pulley whose surface is inclined relative to its axis of rotation. I came across this explanation in a fantastic old book called by Schwamb, Merrill, and James, published in 1921 by Wiley.
Crowned pulleys work well in practice provided that the belt material is not very stiff and that the belt width is not too large. Based on this understanding, one can compute how much crown to put into the pulley for a given tension and belt material.