Where the mathematical structure of Quantum Mechanics comes from