311.1. As the end of combat step begins, all “at end of combat” abilities trigger and go on the stack. (See rule 410, “Handling Triggered Abilities.”) Then the active player gets priority and players may play spells and abilities.
311.2. As soon as the end of combat step ends, all creatures and planeswalkers are removed from combat. After the end of combat step ends, the combat phase is over and the postcombat main phase begins.