Confused about lasers I am sorry if these questions are basics, but I am not sure I totally understand the basics of how a laser works and the books I read are not totally clear for me, so any explanation would be greatly appreciated. So assuming we have a plane mirrors cavity and a gain medium in between, we create a population inversion in the gain medium, which initially creates photons by spontaneous emission and the photons that are produced parallel to the axis of the cavity gets amplified. The amplification is produced by stimulated emission due to the fact that the photons produced this way are in phase with the initial ones. So in the end from one spontaneous emitted photon you have a lots of photons. Here are my questions:
1) These spontaneous emissions can happen many times and at different locations inside the gain medium. But these spontaneously emitted photons are not in phase with each other (but they have the same frequency). So if 2 spontaneously emitted photon are out of phase by half a period, even if they get individually amplified a lot you would have 2 huge bunches of photon out of phase with each other. So the 2 electric fields would be huge, but they would cancel each other, so the output of the laser would be zero. Of course perfect cancelation is unlikely but I feel like overall, given the huge number of spontaneously emitted photons there would be lots of cancelations. So even if the amplification of one photon is super efficient overall it seems like this is an inefficient process due to this out of phase problem. What am I missing here?
2) Assuming there is just one bunch of photons (basically ignoring the problem in 1) ), the laser output appears when these photons hit one of the mirrors. So this happens every 2L/c seconds, where c is the speed of light in that medium and L the length of the cavity. So the laser created will appear as a pulse. However, I read that there are continuous wave lasers, too. How does that work? Doesn't the light still need to go back and forth between the 2 mirrors, how can you get a continuous output? 
Thank you!
 A: Belated answer, hopefully still useful. It sounds like you're trying to think very microscopically about individual photons zooming around within the cavity, and that this is leading you astray. I'd encourage you to think about this part of the laser's operation much more classically.
A laser cavity is nothing more than an electromagnetic boundary value problem. If you analyze the cavity using maxwell's equations, you find that there are certain discretized solutions which are stable in time - the cavity modes. These in general will have close to perfect nodes at the mirrors, and the different solutions will have different numbers of nodes in between, and hence different frequencies. In general, once you start pumping the gain medium, it's not at all obvious which mode the laser will "pick" to operate at. As you describe, the different modes can be in principle active at the same time, and the phases of the different modes at a given location in space will generally not match, leading to complicated interference patterns of the different modes. This is a real thing which can happen in lasers, where a laser becomes "multi-mode". It's almost always undesirable. For a laser to be single mode, you need to engineer a laser which has a gain profile (in frequency space) which strongly selects a single mode. If one mode has much more gain than the others, then it can suppress the gain of other modes, leading to only the single desired mode surviving. Before a laser is "lasing", it is described by this complicated interference of all the modes as you describe. It's in general a hard engineering challenge to reliably construct lasers which are single mode in this way e.g. across a wide bandwidth, at high powers, and at different laser temperatures. For reference, I'm mostly thinking of semiconductor diode lasers here, but the same ideas should apply generally.
For your second question, hopefully thinking about this in terms of cavity modes is already helping. The electromagnetic field of the mode should look like a standing wave, not a pulse as you seem to be describing. A pulse as you describe can be constructed out of a particular sum of all of the cavity modes, but this typically requires some careful engineering to get right. In particular the kind of pulse chain you describe is characteristic of a "frequency comb" system. But in single mode operation, each photon is spread out throughout the laser cavity like the mode's field, and so is in this way continuously "hitting" the mirror and leaking out of the cavity.
A: 
So even if the amplification of one photon is super efficient overall it seems like this is an inefficient process due to this out of phase problem. What am I missing here?

Basically, there won't just be two photons. There will be millions (or more) of them (which is still a tiny amount of light). Some of them will be close enough to in phase with each other that their "daughter" protons created by stimulated emission constructively interfere rather than destructively interfere.
And each time a photon in one state (polarization, frequency, phase, etc) triggers a stimulated emission event, not only does this increase the number of photons in that state; it also decreases the number of excited electrons available to provide amplification to photons in other states. This is a positive feedback mechanism that quickly, and more or less randomly, selects one of the initial states to dominate the others.

the laser output appears when these photons hit one of the mirrors. So this happens every 2L/c seconds, where c is the speed of light in that medium and L the length of the cavity. So the laser created will appear as a pulse. However, I read that there are continuous wave lasers, too. How does that work? Doesn't the light still need to go back and forth between the 2 mirrors, how can you get a continuous output?

I started to answer this, and realized I don't have a complete answer for you.
But for one thing, consider that the photons are subject to the uncertainty principle. The more exactly we know their momentum (which is related to their wavelength), the less accurately we can know their position. Since there is uncertainty in the position of the photon, there's uncertainty about when exactly it arrives at the mirror. 
For another, consider that the stimulated emission process only crudely selects the operating frequency of the laser. The cavity modes typically are more selective, and the requirement that the light wave evolves by an integer multiple of $2\pi$ radians for each round trip through the cavity is what determines the linewidth of the laser output. This means the stimulated emission process is able to keep many populations of photons with slightly different frequency experiencing gain at the same time. But the cavity will pick out a narrow segment of the total population to be the actual lasing mode, and there's no reason this selection mechanism will lead to all of the energy reaching the mirror at the same time.
