Smogon doesn't really define them as detailed as one might hope so here's my take on this
Early game - the turns where you try to figure out the sets of the Pokemon you're facing. I mean you do have about ninety seconds when you're selecting who to send out first but that's only a wild guess. This part is basically trying to confirm it. This is also the turns where you try to get hazards up and where you try to get rid of them and figure out which one is the threat to your team
Midgame - the point where you now have a clear idea of the sets your opponent is using and you're trying to kill his or her Pokemon or at the very least, slowly whittle it down. This is basically when you switch a lot so you can get a favorable matchup and prediction heavily comes into play in this part of the battle
Endgame - there is no clear point on when it begins. Basically, this is when you or your opponent lose a key member or multiple members of the team and the other guy now has the advantage and can completely end the game in the next few turns. It also doesn't necessarily have to be taken down. Said member or members being weakened enough could also start the endgame. There are many scenarios to this such as getting rid of steel types for Mega Alakazam to go mayhem or getting rid of that Pelipper or Charizard that's really bugging your Tyranitar's sand or even letting your Mega Gyarados get two dragon dances up. Of course, just because one lost a key member doesn't mean its gg. The other guy might be able to make a comeback if the one that has the advantage chokes