In chess, the middlegame refers to the portion of the game where both players have developed all or most of their pieces and both kings have castled to relative safety or otherwise made a move invalidating their right to castle. The middlegame is contrasted to the opening (the portion of the game before these conditions have been met) and the endgame (the portion of the game after most pieces have been removed from the board).
In contrast to the opening and the endgame, the middlegame has much less chess theory, as with so many pieces on the board farther and farther from their starting positions, there are too many possible permutations for players to memorize all possible lines in advance and there is the highest level of variance from previously played games. This means that the middlegame comes closest to "pure chess," where the players have to rely on their intuition and natural chess ability rather than memorization of specific lines or patterns. At best, players can memorize certain chess principles or themes, but these will not apply in all situations.
At the grandmaster level, sometimes chess theory does extend well into the middlegame, but even grandmasters will eventually reach a point where theory runs out and they are suddenly on their own.