How to solve $\max_{f}\int_{0}^{\infty}f\left(x\right)dx$ subject to $\int_{0}^{\infty}xf\left(x\right)dx=x_{0}$? How to find $\max_{f}\int_{0}^{\infty}f\left(x\right)dx$ subject to $\int_{0}^{\infty}xf\left(x\right)dx=x_{0}$,
where $f$ is a function and $x_{0}$ is a constant?
 A: Case 1: No restrictions on $f$ 
Taking $f(x)$ as a huge Dirac delta function centered at some small $\epsilon > 0$ as $$f(x) = \frac{x_0}{\epsilon}\delta(x - \epsilon)$$ gives you $$\int_{0}^{\infty} x f(x) dx = x_0$$ as required, and $$\int_{0}^{\infty} f(x) dx = \frac{x_0}{\epsilon}.$$ Letting $\epsilon \to 0$ thus gives you that the maximum is unbounded (unless you are given more restrictions on $f$).
Case 2: $f$ is a probability density function
Then, by definition, $$\int_{0}^{\infty} f(x) dx \leq 1,$$ and taking $f(x) = \delta(x - x_0)$ achieves this bound. Note that this $f$ corresponds to a discrete random variable $X$ with $P(X = x_0) = 1$.
For extra insight, note that the question can be nicely formulated in terms of probabilities:

Find $\max_F (1 - F(0))$ subject to $E(X) = x_0$.

Then the solution $X \equiv x_0$ described above becomes even more obvious.
A: Since $f$ is a probability density function, 
$$\max_f \int_0^\infty f(x)\mathrm dx 
\leq \max_f \int_{-\infty}^\infty f(x)\mathrm dx = 1.$$
Since $x_0$ is necessarily a positive number, then 
for any positive random variable 
$$\int_0^\infty f(x)\mathrm dx 
= \int_{-\infty}^\infty f(x)\mathrm dx = 1$$
(since $f(x) = 0$ for $x < 0$)
and so $\max_f \int_0^\infty f(x)\mathrm dx = 1$.
Or, did you mean to ask

What is $\max_f \max_{x\in (0,\infty)} f(x)$ over all
  probability density functions $f(x)$ such that 
  $\int_0^\infty xf(x)\mathrm dx = x_0$ where $x_0$ is
  a finite positive constant?

in which case TMM's answer shows that $f$ 
can have arbitrarily large value.
