Here is the proof verbatim, supposed to be from Euler:
Let $\pi(x) := \#\{p\le x: p \in \mathbb P\}$ be the number of primes that are less than or equal to the real number $x$. We number the primes $\mathbb P = \{ p_1, p_2, p_3...\}$ in increasing order. Consider the natural logarithm $\log x$, defined as $\log x = \int_1^x \frac{1}{t} dt$.
Now we compare the area below the graph of $f(t)=\frac{1}{t}$ with an upper step function. Thus for $n\le x < n+1$ we have
$$\log x \le 1 + \frac12 + \frac13 ... \frac1n + \frac{1}{n+1}$$ $$\log x \le \sum \frac1m$$ Where the sum extends over all $m\in\mathbb{N}$ which have only prime divisors $p\le x$.
Since every $m$ can be written in a unique way as a product of the form $\prod\limits_{p\le x}p^{k_p}$, we see that the last sum is equal to $$\prod\limits_{p\in \mathbb P, p\le x}\left(\sum\limits_{k\ge 0}\frac{1}{p^k}\right)$$ The inner sum is a geometric series with a ratio $\frac{1}{p}$, hence $$\log x \le \prod\limits_{p\in \mathbb P, p\le x}\frac{p}{p-1} = \prod\limits_{k=1}^{\pi(x)}\frac{p_k}{p_k-1}$$ Now clearly, $p_k\ge k+1$, and thus $$\log x \le \prod\limits_{k=1}^{\pi(x)}\frac{k + 1}{k} = \pi(x) +1$$ Since $\log x$ is not bounded, we conclude that $\pi(x)$ is not bounded, and hence there are infinitely many primes
In short
Basically, I do not understand many steps in the proof, mainly the jump from $\frac1m$ onwards, where the sum of the $\frac1m$ was broken down into a product of a sum of reciprocals of primes.
Specific
I do not understand the following:
Where the sum extends over all $m\in\mathbb{N}$ which have only prime divisors $p\le x$. Why is this so? Shouldn't this include only a very small subset of such $m$, and not all of them?
What does $p^{k_p}$ mean in when we say that each of the $m$ can be represented as a product of such powers of different $p$. What I understood is that $k_p$ is the power which appears with $p$ in the prime factorization of $m$. But if this is so, then I absolutely fail to understand the next step (3.)
I do not understand how we could keep the product outside the sum. And here, why is the $k_p$ in the former step reduced to $k$?
My attempt
I tried pondering over this for quite a while, as well as looking at other sites on the net if they may present a more descriptive and less concise proof for this. But I failed to find any.
The intention is to show that $\log x \le \pi(x) + 1$. This only makes sense for $x > 0$.
For $x \le e$ it is trivial since $\log x \le 1$. Thus, in the following considerations we may assume $x \ge 1$. We have $$\log x = \int_1^x \frac{1}{t}dt < \int_1^{n+1} \frac{1}{t}dt = \sum_{m=1}^n \int_m^{m+1} \frac{1}{t}dt < \sum_{m=1}^n \int_m^{m+1} \frac{1}{m}dt = \sum_{m=1}^n \frac{1}{m}$$ which corrects the formula in your question.
Let $\mathbb P (x)$ denote the set of primes $\le x$ and $\mathbb N (x)$ the set of integers all of whose prime divisors are in $\mathbb P (x)$. Each $m \in \mathbb N (x)$ has a unique representation $m = \prod_{p \in \mathbb P (x)} p^{k_p(m)}$ with $k_p(m) \in \mathbb N \cup \{ 0 \}$.
Since $n \le x < n+1$, all $m \le n$ belong to $\mathbb N (x)$ and we obtain $$\sum_{m=1}^{n} \frac{1}{m} \le \sum_{m \in \mathbb N (x)} \frac{1}{m} .$$ Note that the sum on the right hand side is infinite. That it converges will be seen in the sequel.
$\sum_{k=0}^\infty\frac{1}{p^k}$ is a geometric series converging absolutely to $\frac{p}{p -1}$. It is well-known that the product of absolutely convergent series can be written as an absolutely convergent series (see e.g. Product of absolutely convergent series is absolutely convergent). Writing $\mathbb P (x) = \{p_1,\dots,p_r \}$, we obtain $$\prod_{p \in \mathbb P (x)}\sum_{k=0}^\infty\frac{1}{p^k} = \prod_{i=1}^r\sum_{k=0}^\infty \frac{1}{p_i^k} = \sum_{s=0}^\infty d_s$$ with $$d_s = \sum_{k_1,\dots,k_r \ge 0 \text{ with } k_1 + \dots + k_r = s} \prod _{i=1}^r \frac{1}{p_i^{k_i}} .$$ Therefore $$\prod_{p \in \mathbb P (x)}\sum_{k=0}^\infty\frac{1}{p^k} = \sum_{k_1,\dots,k_r \ge 0} \prod _{i=1}^r \frac{1}{p_i^{k_i}} = \sum_{m \in \mathbb N (x)} \frac{1}{m} .$$ This shows that the series on the right hand side is absolutely convergent to $\prod_{p \in \mathbb P (x)} \frac{p}{p -1}$.