Modeling self-organization in pedestrians and animal groups from macroscopic and microscopic viewpoints