The objective of the opening is quite clear - develop your pieces quickly, castle and bring your king to safety, etc. Once this phase is over, and you are into the middle game, the question arises - now what?! What are some good plans to pursue in the middle game? Generally, I go for an all out attack on the enemy king. If played well, it could result in some advantage - either the opponent gets checkmated or he is forced to give up material in order to avoid a checkmate. However, in some cases the opponent king is heavily fortified - for eg. there is a doubled f or c pawn on the side where his king has castled, or there is a fianchetto bishop on the same side as the castled king which gets in the way of a mating attack. In such situations, is it advisable to still go for a mating attack? Or are there some other plans which can be pursued? How to gain an advantage? What are some common plans/strategies?
Although your question is quite broad, the general ideas in the middlegame are the following-
1) Improve the position of your pieces- knights on outposts, bishops on open diagonals, rooks on open files, etc.
2) If a piece is badly placed and cannot be improved, see if you can exchange it for one of your opponent's better placed pieces.
3) Create weaknesses in your opponent's pawn structure, by provoking certain pawn moves. Note that every pawn move is irreversible, thus you must watch out for opportunities where you can provoke pawn moves from your opponent that would weaken their position.
4) If you yourself have weaknesses, see if you can eliminate them; if not, guard them well.
5) Keep your pieces co-ordinated and see if you can disturb the co-ordination of your opponent's pieces.
6) Keep your king safe and see if the opponent's king position can be compromised.
7) Look for transpositions into favorable endgame positions (e.g. two bishops vs two knights or two bishops vs bishop and knight in open positions).
With respect to your particular approach, attack's on the opponent's king are not always justified. It may work at the beginner level, but a stronger opponent will be able to refute an unfounded attack. In order to attack, first of all, there must be something to attack- weaknesses. If your opponent has no weaknesses, then your attack will come to nothing and you risk ruining the co-ordination of your pieces.
The better approach therefore is to work for the accumulation of advantages. A single advantage (like a knight on a good outpost) is often not enough to win. You must try to accumulate as many advantages as you can before you can deal the lethal attacking blow. Of course, if the opponent makes a mistake or blunders, then the lethal blow can come quickly. If not, slow yet constant improvement of your position is the best way to go.
In addition to Wes answer, try also to play and examine the games of chess grand masters. By watching their games you can get a bunch of ideas on how they perform an attack. Check out these sites:
Another good place to learn "chess planning" is by watching annotated chess games in Youtube where every move is explained, including the plans behind the moves. Check out these Youtube Chess channels:
My two cents ;)