TITLE: Ideas in the elementary proof of the prime number theorem (Selberg / Erdős)
QUESTION [31 upvotes]: I'm reading the elementary proof of prime number theorem (Selberg / Erdős, around 1949). 
One key step is to prove that, with $\vartheta(x) = \sum_{p\leq x} \log p$,
$$(1) \qquad\qquad \vartheta(x) \log x+\sum_{p\leq x}(\log p) \vartheta(x/p) = 2x\log x+O(x)$$

What's the idea behind this identity?
Here is the heuristic argument I understand : if $p$ is a prime number, the average gap before the next prime is $\approx \log p$. Thus if we set a weight $0$ for non-prime numbers, and $\log p$ for prime numbers, then when we sum all these weights for $n = 1 ... x$, we should get $\vartheta(x) = \sum_{p \leq x} \log p \sim x$, and that's equivalent to the PNT. Ok. 
But where comes the idea from, to add on the left hand side of the identity (1) the part $\sum_{p\leq x}(\log p) \vartheta(x/p)$ ? What's the idea here?
What's the idea to go from (1) to the prime number theorem?


Note: the identity (1) can be replaced by an equivalent identity, with $\psi(x) = \sum_{p^k\leq x} \log p = \sum_{n \leq x} \Lambda(n)$ (where $\Lambda(n) = \log p$ if $n=p^k$ and $0$ otherwise):
$$(2) \qquad\qquad \psi(x) \log x+\sum_{n\leq x}\Lambda(n) \psi(x/n) = 2x\log x+O(x)$$
Another equivalent form is (just in case (2) or (3) might be easier to understand):
$$(3) \qquad\qquad \sum_{p \leq x} (\log p)^2 + \sum_{pq\leq x} \log p \log q= 2x\log x+O(x)$$

REPLY [3 votes]: Two very nice answers have already been given, but I would like to add that Michel Balazard has a book in preparation on this topic (written for undergrads), in which he tries to give a deduction of the PNT from Selberg's identity which as simple as possible. Also, a student here has a nice write-up of the proof. It is very short, it is elementary, but it is in french.