If you're asking how to force a win in every case, against every player, obviously you can't. Middlegame wins happen only when one player makes serious enough mistakes and the other player knows how to exploit those mistakes. No mistakes, no win. Chess is inherently a draw.
If you're asking for *general* plans for how to attack a castled king, that's a big topic, and depends partly on the opening.
I always met with endgame.How can I attack the castled king and win in middle game?