Mathematical surprises and Dirac's formalism in quantum mechanics