Each primer and DNA strand has a 5' to 3' orientation, that the polymerase "sees", and only extends the 3' end. You'll notice that your PCR product with the same primer at both ends had the 3' end primer in reverse complementary orientation (when reading one strand sequence) so that at both only the 3' end of that primer was extended. When the primer is "searching" for somewhere to anneal and extend, it can't tell the difference between one strand or the other, but just "looks" at all DNA for somewhere that it can find a sequence that it matches well enough at that temperature and salt concentration to anneal to. If the 3' end matches well enough, it will extend. If it finds perfect matches close enough to each other on the sense and and antisense strands, and if both are oriented so the 3' ends point toward each other, a PCR product will be generated (correction: both 3' ends MUST be oriented towards each other, since DNA must anneal to another strand in the opposite orientation). The primer does not realize that it's twin sister already primed the other strand. If the temperature is far enough below the Tm of the primer, a PCR product can be formed even if the primer has one, or several mismatches to the template. I found I needed to draw this out on paper, at first, to understand it.