Is there any specific point where the middle-game ends and end-game begins? E.g. after x number of pieces are exchanged, or say 40 moves, etc.
One old definition of the endgame was when the main objective is to "queen a pawn," (as opposed to other goals such as forcing an imminent checkmate).
Now there is an exception noted in the comments where one side will try to mate the other side's lone king with a king and two bishops, or a king, bishop and knight. But it's likely that one side obtained this material advantage by trying to queen extra pawns, and forcing the other side to trade pieces for them.
There isn't a clear-cut definition of endgame, or a set of criteria where you could draw a line and say "after this move, we have reached the endgame."
Quoting Glenn Flear in his excellent book Practical Endgame Play - Beyond the Basics:
The word 'endgame' is widely used and generally implies the final phase of the game (however long!), assuming that there already has been significant simplification. If we had to define the word more rigorously in terms of material then opinions vary. Some specialists consider all queenless positions to be endgames, others those where both sides have limited material, for instance less than queen and rook.
So basically, once the position becomes 'simplified' to the point where more often than not you are using your few remaining pieces (including the King) to try and queen a pawn, rather than organize an attack. Also included would be the end result of queening a pawn (or winning significant material), i.e. positions where you mate the King with only a few pieces on the board, like King and Rook vs. King.
According to the classic old book of Romanovski (which was one of the cornerstones of the Russian/Soviet school of chess) the endgame starts when the King assumes an active role.
The middle game starts as soon as the opening ends, and well, it is very easy to know when openings start and end, almost any opening (if not all) have names and are well known and stuided. But if I were forced to say an specific moment in time, I would say around the time where they start castling or exchanging serious material to gain position advantage.
However, the end game is harder to accurately say when it starts, my best guess will be somewhere where the kings start moving towards the center and players have usually no more than 2 minor pieces or 4 pawns. Anytime where it is possible to calculate the result using Endgame Tablebases.
It is also worth mentioning that the point where something starts and ends vary from game to game (e.g if the players decide to quickly exchange material they will get to the endgame pretty soon), and some games don't even have end games (or even middle games!) if they blunder or fall in traps.
Quoting from rate your endgame by Edmar Mednis
"...perhaps this is clearer when approached negatively"
What does this mean? Well we know in endgames and middlegames, there are totally different plans. The most well known example is undoubtably the Isolated Queen Pawn(IQP) case. IQP can offer dynamic chances in middlegame, but it's always a weakness in endgames. So by working retrogressively, we can know what phase we are in.
Better development, open file and misplaced pieces etc are crucial
Pawn structure, availability of passed pawns, availability of weak pawns are crucial
[FEN "3r1r2/1bp5/1p3k1p/pP4p1/4Pp1P/2P2P2/1P4RB/4R1K1 w - - 0 1"]
In this position, we clearly know that black has advantage, due to white's bad bishop and black's control over d-file. White, despite having a protected passed pawn and created a black backward pawn has no advantage.
Hence, we know that this position is a middlegame.
Note that there is not much mentioning of how much material must be removed before endgame starts. This is due to the fact that endgames can occur despite large amount of material on board. E.g. Queen pawn vs Queen pawn, Queen Rook Pawn vs Queen rook pawn and so on
The endgame begins when the kings can wander out from their hiding places without risking being checkmated.
Opening is the phase of the game where your strategic goal is to develop and you aim to build some sort of (direct or indirect) territory control: either an advantage or simply an unbalance.
Middlegame is when you start to use that territory control to achive the next strategic goal like a direct attack (tactics is incidental here, not a purpose per se) or a conversion to a position where other strategic goals can be pursued like liquidation into a favorable ending.
Ending is either when you have built a positional/material advantage big enough and you simplify to remain in a position where you can force a win whatever defense the opponnet uses, or more generally when you play to gain that advantage as main purpose.
Of course one can try gain to obtain a winning material advantage in the middlegame, but that is incidental and not the main goal one follows: material advantage is obtained, besides blunders, as consequance of/defence against some sort of direct attack.
In the endgame direct attack instead are used as threats and the main goal is as said reaching a forcefully winning positional or material advantage.
The endgame is the last moves scenario that comes to a checkmate or a draw so we cannot say "and now the endgame starts" during the game because the future is unseen. Therefore, the middle-game is something bounded after the game too. No term of these two is official in chess rules, but we use both mostly in chess lessons or game analysis.