The middlegame (in chess terms) is the stage of the game after the opening. There isn't a clear line between the opening and the middlegame, or the middlegame to the endgame as some openings blend from the opening to the middlegame, especially in sharp (highly tactical) openings, although the middlegame usually starts after the development of both sides has been completed and both kings are safe.
After the first moves in the Najdorf Sicilian (1.e4 c5 2.Nf3 d6 3.d4 cxd4 4.Nxd4 Nf6 5.Nc3 a6):
White can choose to go in the sharp main line with 6.Bg5 after which black can play in a lot of different ways. For example, after 6...e6 7.f4 black can play 7...Qb6 attacking the pawn on b2. After 7...Qb6 the main line for white is 8.Qd2 sacrificing the b2-pawn (poised pawn variation),
after which play could continue Qxb2 9.Rb1 Qa3 10.f5 Nc6 11.fxe6 fxe6 12.Nxc6 bxc6 13.e5 dxe5 14.Bxf6 gxf6 15.Ne4 Be7 16.Be2 h5 17.Rb3 Qa4 18.Nxf6+ Bxf6 19.c4, etc.
As you can see, the following moves are very complicated and are analyzed way out of the opening stage:
Ignore your opponent's threat by creating a stronger threat.
Before starting an attack, you must have a plan. If you don't have a plan, look at the ratio of attackers and defenders on the side where you are attacking. Remember, the opposing king is counted as a defender.
Attack is the best defense. Always look for attacks. Focus your attention on your opponent's half of the board and think on how you can make attacking moves there.