What are some ways one can keep the initiative? I find in many cases I have the upper hand if I am able to keep my opponent defending instead of creating his own attack. Are there openings or certain moves in the beginning that help keep the initiative?
From my own experience the best way to maintain initiative is remain active. Don't make timid moves, you will occasionally overreach doing this but you will learn what is overly bold and what is simply active play. Also I have found that the better a plan I have the more active my play, it is when I am floundering around not sure where to go from here that I have the worst time keeping initiative.
Be familiar with the general opening principals, (open lines, knights before bishops, rooks on open ranks, don't make more than 2 pawn moves in the opening, don't move that same piece twice in the opening, etc) none of these are hard fast rules that should never be broken but they will keep you in the right direction in the first part of the game.
Finally I would be familiar with the basic weapons of chess, (pins, forks, etc) and learn to look for them not only in the current position but in positions that you could reach if you make whatever move you are contemplating. They will tell you both what to watch out for and what tactical opportunities you have to advance your own game, and extend, or update, your plan as the game proceeds.
One final thought, have a reason, tactical or not but a specific reason, for every move. If you move without a specific reason your are floundering and no longer on the initiative.
Keeping the initiative is very important because it allows you to control the game. For the most part, you have the initiative when your move directly forces an opponent's move or greatly narrows your opponent's choices down.
Trading initiative for material
Often times initiative is sacrificed in order to gain material. In the case of a piece this is worthy. However, in the case of a pawn (and sometimes with pieces), then there are few guidelines to follow. When you have gained sufficient initiative to gain a pawn, make sure to double check if you will loose too much tempo taking it. Moreover, just the threat of taking the pawn can sometimes be stronger than actually taking the pawn, as it can weaken the opponents position in other places while they scramble to get a hold on the pawn's defense. During this time, you can be formulating a strong unopposed attack elsewhere which would presumably be planned on gaining more than a pawn.
Don't get me wrong, winning a pawn is the win. But sometimes there are stronger alternatives.
If you have the initiative, then it is highly likely you just forced your opponent to make a certain move. The first thing to consider is how to have the largest impact on their choices. This means making "annoying" moves to boot or relocate pieces which are vulnerable, checking, building material on a target, basically directly influencing their move. Sometimes it can be very difficult to determine how to keep the initiative in this type of situation when none of those are available. When that is the case, it is important to see what move you can make which will allow for the next move to directly force your opponent to respond. When you realize what move that is, your opponent probably will too and will then be forced to make a move in response to your future move allowing you to retain the initiative (always assume your opponent knows your plan - the moves should be unstoppable even if known in advance, just like a forced mate scenario).
The important point here is knowing what initiative is and recognizing when you have it. To me, initiative is not just making your opponent make forced moves by, e.g., chasing the Q up the board with a couple of minor pieces where in the end the Q settles on a nice square but your pieces are uncoordinated and sit in useless spots. As soon as that happens, your so called initiative is gone and the tables turn. I think of initiative as having obtained tempi that can be used to build a better position, along the lines of the usual strategic considerations: space, coordination, pawn structure. Also, having targets in the opponent's camp is important in ensuring that your plan has teeth. Once you have those long-term advantages, you can use them to do more of the same: advance pawns, improve coordination, increase mobility, add targets or increase pressure on existing ones, or improve king safety.
First, develop your pieces quickly in the opening.
Second, look to gain time. A lot of times people will exchange or move a piece back when that piece is attacked but if you can defend it by developing a piece you are gaining time. For example the line, 1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. Ng5 d5 5. exd5 Na5 6. Bb5+ Bd7 7. Qe2 white is defending the bishop by developing the queen. There are other ways to gain time but that should give an example.
Third, look to create threats even when you are on the defensive. In the above line, notice that the queen is attacking the e-pawn also. Attacking and defending at the same time is critical to maintaining the initiative.
Fourth, learn to ignore the opponents threats if they aren't real threats. Learn to calculate things out accurately. If you can mate in 3 and the opponent will take four moves why do you care about what your opponent is doing?