Process of formation and development of spermatozoa, including spermatocytogenesis and spermiogenesis.