Expectation of a random variable with a staircase distribution function 
There is a function $F(x) = \sum_{i=1}^{\infty} 2^{-i} \mathbb{1}_{[\frac{1}{i},\infty)} (x)$. It is defined on a measure $\mathrm{Pr}$.  I have shown that $F(x)$ is a distribution function on $\mathbb{R}$.
And I am asked to show the expectation $\mathbb{E} X$, where the random variable is $X(x)=x$.
Also, I have to express $\mathbb{E} (\frac{1}{X})$.

That is my derivation:
\begin{align*}
\mathbb{E}X
&= \int_{\Omega} X(\omega) \, d\mathbb{P}(\omega) \\
&= \int_{\mathbb{R}} x \,d\mathrm{Pr}(x) \\
&= \int_{\mathbb{R}} x \frac{d\mathrm{Pr}(x)}{d\mu(x)} \, d\mu(x) \\
&= \int_{\mathbb{R}} x f(x) \, d\mu(x)
\end{align*}
where $\mu$ is the counting measure and $f(x)$  is the density function, which is the derivative of probability distribution with respect to the counting measure. $\mathbb{1}_{[\frac{1}{i},\infty)} (x)$ is the indicator function. 
However, I was stuck here.  I am not sure if my derivation above is correct and what I should do next. Could anyone point out what is the next and what's wrong with my formula?
By the way, there is a hint to let me use the Taylor expansion of $\log(1+x)$ or $\ln(x)$. I find nowhere to use this.
And should I do the same integration for the $\mathbb{E} (\frac{1}{X})$ ?
There is an interpretation for $F(x)$:
\begin{align*}
F(x)
&= \sum_{i=1}^{\infty} 2^{-i}\mathbb{1}_{[\frac{1}{i},\infty)} (x) \\
&= 2^{-1}\mathbb{1}_{[\frac{1}{1},\infty)}(x)
+ 2^{-2}\mathbb{1}_{[\frac{1}{2},\infty)}(x)
+ 2^{-3}\mathbb{1}_{[\frac{1}{3},\infty)}(x)
+ \cdots
\end{align*}
The graph of $F(x)$ is staircase.
 A: We have
\begin{align*}
\mathbb{E}[X]
= \int_{\mathbb{R}} x \, \mathrm{d}F(x)
&= \sum_{i=1}^{\infty} \int_{\mathbb{R}} x \, \mathrm{d} \Bigl( 2^{-i} \mathbb{1}_{[\frac{1}{i},\infty)} (x) \Bigr) \\
&= \sum_{i=1}^{\infty} 2^{-i} \int_{\mathbb{R}} x \, \delta_{\frac{1}{i}}(\mathrm{d}x) \\
&= \sum_{i=1}^{\infty} \frac{1}{i \cdot 2^i} \\
&= \log 2.
\end{align*}
Similarly,
\begin{align*}
\mathbb{E}[X^{-1}]
= \int_{\mathbb{R}} \frac{1}{x} \, \mathrm{d}F(x)
&= \sum_{i=1}^{\infty} \int_{\mathbb{R}} \frac{1}{x} \, \mathrm{d} \Bigl( 2^{-i} \mathbb{1}_{[\frac{1}{i},\infty)} (x) \Bigr) \\
&= \sum_{i=1}^{\infty} 2^{-i} \int_{\mathbb{R}} \frac{1}{x} \, \delta_{\frac{1}{i}}(\mathrm{d}x) \\
&= \sum_{i=1}^{\infty} \frac{i}{2^i} \\
&= 2.
\end{align*}
A: $F \, : \, \mathbb{R} \to \mathbb{R}$ is said to be a distribution function on $\mathbb{R}$ iff
(D1) $F$ is increasing, i.e $x \leq y \implies F(x) \leq F(y)$
(D2) $\lim_{x \to -\infty}{F(x)} = 0$ , $\lim_{x \to +\infty}{F(x)} = 1$.
(D3) $F$ is right-continuos, i.e $\forall x \in \mathbb{R} \; \lim_{y \to x^+}{F(y)} = F(x)$
Therefore you need to verify (D1), (D2) and (D3)
To prove (D1) observe that every function in the sum is incrasing, therefore the sum, which is by definition $F(x)$, is increasing.
To prove (D2) observe that when $x \leq 0$ $F(x) = 0$, and when $x \geq 1$ $F(x) = \sum_{i = 1}^{\infty}{2^{-i}} = 1$ so (D2) is verified.
To prove (D3) observe that by Weiestrass M-test you have that $\sum_{i =1}^{\infty}{2^{-i} 1_{[1/i,+\infty) }} $ converges uniformly to $F(x)$ therefore the following interchange of limits if justified
$$\lim_{y \to x^+}{F(y)} = \lim_{y \to x^+}{\lim_{n \to \infty}{ \sum_{i=1}^{n}{ 2^{-i}1_{[1/i,\infty)}(y) } }} = \lim_{n \to \infty}{\bigg(\lim_{y \to x^+}{ \sum_{i=1}^{n}{ 2^{-i}1_{[1/i,\infty)}(y) } }\bigg)} = \lim_{n \to \infty}{\bigg( \sum_{i=1}^{n}{2^{-i} 1_{[1/i,\infty)}(x) }\bigg) } = F(x) $$
Therefore (D3) is verified and $F$ is a distribution function.
Let $Pr$ be the unique measure over $\mathbb{R}$ that admits $F$ as it's distribution function ( consider the set function $Pr( (a,b] ) := F(b) - F(a)$, now  $Pr$ exists by Caratheodory's Extension theorem and is unique by $\pi-\lambda$ systems theorem ).
Let's calculate $\mathbb{E}(X)$ and $\mathbb{E}(1/X)$, because $Pr(-\infty,0] = F(0) = 0$ and $Pr( [1,\infty) ) = 1 - F(1) = 0$ I have that
$$\mathbb{E}(X) = \int_{\mathbb{R}}{x dPr(x) } = \int_0^1{x dPr(x)}$$
$$\mathbb{E}(1/X) = \int_{\mathbb{R}}{1/x dPr(x) } = \int_0^1{1/x dPr(x)}$$
I will use the following lemma

Lemma
Let $f \, : \, (0,\infty) \to \mathbb{R}$ be a continuos function ( $f$ does not  have to he continuos on $0$ ! ), then one has
$$\int_{0}^{1}{ f(x) dx} = \sum_{i \in \mathbb{N}}{f(1/i) 2^{-i} } $$
To prove it let $\epsilon > 0$, let $0 < \delta_i < 1/i$ be such that $|x - 1/i| < \delta_i \implies |f(x) - f(1/i)| < \epsilon $
Let
$$\mathcal{A}_\epsilon := \bigcup_{i = 1}^{\infty}{ (1/i - \delta_i , 1/i + \delta_i ] } $$
By letting the $\delta_i$ be smaller I can wlog assume that the union is disjoint, therefore I have
$$Pr(\mathcal{A}) = \sum_{i=1}^{\infty}{ Pr((1/i - \delta_i , 1/i + \delta_i ] ) } = \sum_{i=1}^{\infty}{ F(1/i + \delta_i) - F(i/i - \delta_i ) } = \sum_{i=1}^{\infty}{ 2^{-i} } = 1$$
Therefore
$$\bigg| \int_0^1{f(x)dPr(x)} - \sum_{i \in \mathbb{N}}{ f(1/i) 2^{-i} } \bigg| = \bigg| \sum_{i \in \mathbb{N}}{ \int_{1/i - \delta_i}^{1/i + \delta_i}{ f(x) - f(1/i) dPr(x) } } \bigg| \leq \sum_{ i \in \mathbb{N}}{ \int_{1/i - \delta_i }^{1/i + \delta_i }{ |f(x) - f(1/i) | dPr(x) } } \leq \sum_{i \in \mathbb{N}}{ \int_{1/i - \delta}^{1/i + \delta_i}{ \epsilon dPr(x)} } = \int_{\mathcal{A}}{\epsilon dPr(x) } = \epsilon $$
Now just let $\epsilon \to 0$

By applying the lemma to $f(x) = x$
$$\mathbb{E}(X) = \sum_{ i \in \mathbb{N}}{ \frac{1}{i} 2^{ - i } } = \sum_{i = 1}^{\infty}{ \frac{1}{i} (1/2)^{i} } = log(1 - 1/2) = log(1/2) = -log(2)$$
Where I have used the hints you wrote down.
By applying the lemma to $f(x) = 1/x$ one has
$$\mathbb{E}(1/X) = \sum_{ i \in \mathbb{N}}{ i 2^{-i} } = \sum_{i = 1}^{\infty}{ i 2^{-i} }$$
Now let $G(x) := \frac{1}{1 - x} = 1 + \sum_{i = 1}^{\infty}{ x^{i} }$, by derivating term by term I get (at least for $|x| < 1$ )
$$G'(x) = \frac{1}{(1-x)^2} = \sum_{i=1}^{\infty}{ i x^{i-1} } $$
Therefore
$$\frac{G'(1/2)}{2} = 2 = \sum_{i = 1}^{\infty}{ i 2^{-i} } = \mathbb{E}(1/X)$$.
Some final considerations :
I have used the notation $\sum_{i \in \mathbb{N}}{x_i}$ to indicate the sum defined only when ${x_i}\$ is Unconditionally convervent.
*Exercise : * prove that the Lemma doesn't hold if one replaces, in the thesis of the Lemma, $\sum_{i \in \mathbb{N}}$ with $\sum_{i=1}^{\infty}$. To do it prove by contradiction using a continuos function $f \, : \, (0,\infty) \to \mathbb{R}$ such that for all $i \in \mathbb{N}$ $f(1/i) = \frac{-1}{i}$ (assume that $f$ exists, so don't bother about proving it's existence).
If you need you may use Riemann - rearrangement Theorem 
An easier way to prove the lemma is to prove that $$Pr := \sum_{i = 1}^{\infty}{ 2^{-i} \delta(x - 1/i) }$$, meaning that whenever $I \subset \mathbb{R}$ one has
$$Pr(I) = \sum_{i \in \mathbb{N}}{ 2^{-i} }$$, this in fact proves that the lemma holds for all the functions $f \in L^1(\mathbb{R},Pr)$ and because $Pr$ is concentrated on $\{1,1/2,\dots \}$ $f$ need only to be defined on $\{1,1/2,\dots\}$.
I avoided it because I wanted the proof to be more elementary.
