What is your definition of conditional expectation? Intuitively, the conditional expectation of

given

is the function of

which is "closest" to

. In the case of
![E[g(X)|X]](http://latex.codecogs.com/png.latex?E[g(X)|X])
,
)
is itself a function of

, and it is of course the "closest" to
)
, so that
![E[g(X)|X]=g(X)](http://latex.codecogs.com/png.latex?E[g(X)|X]=g(X))
. The formal proof shouldn't be difficult, whatever definition you have; give us the definition you have if you want a more precise solution. (In fact, there's only one definition, but it may well be that you know a definition relative to a particular case, that's why I don't give the general answer yet)
The usual integration by part works if you can differentiate

, which is only possible if the distribution of

is continuous.
In fact there's a more general integration by parts formula for functions with bounded variation, but you probably don't know it.
Then for the general case, you can procede as follows: write
![1-F(x)=P(X>x)=E[{\bf 1}_{\{X>x\}}]](http://latex.codecogs.com/png.latex?1-F(x)=P(X>x)=E[{\bf 1}_{\{X>x\}}])
(this is an indicator function in the expectation, it equals 1 on the event in the subscript, and 0 otherwise), and then by Fubini
![\int_0^\infty (1-F(x))dx=\int_0^\infty E[{\bf 1}_{\{X>x\}}] dx= E\left[\int_0^\infty {\bf 1}_{\{X>x\}} dx\right] = E[X]](http://latex.codecogs.com/png.latex?\int_0^\infty (1-F(x))dx=\int_0^\infty E[{\bf 1}_{\{X>x\}}] dx= E\left[\int_0^\infty {\bf 1}_{\{X>x\}} dx\right] = E[X])
(we integrate 1 when

and 0 otherwise).
Remark: if

is discrete, then

has "steps", so that the integral could be rewritten as a sum.
Other remark: you wondered if
)\to 0)
when

. This is true if
![E[X]<\infty](http://latex.codecogs.com/png.latex?E[X]<\infty)
. Indeed, we have
![x (1-F(x))=xP(X>x)\leq E[X\, {\bf 1}_{\{X>x\}}]](http://latex.codecogs.com/png.latex?x (1-F(x))=xP(X>x)\leq E[X\, {\bf 1}_{\{X>x\}}])
(this may be called Markov inequality, slightly refined), and by the bounded convergence theorem the right-hand side converges to 0.