Group‐theoretical foundations of classical and quantum mechanics. I. Observables associated with Lie algebras