If $\int_0^1 f(x)dx$ exist but $\lim_{x\to 0}f(x)$ doesn't exist, does $\lim_{n\to \infty }\frac{1}{n}\sum_{k=1}^n f(k/n)=\int_0^1 f(x)dx$? I was wondering for something : Let $f:]0,1]\to \mathbb R$ continuous. If $\displaystyle\lim_{x\to 0}f(x)$ exist, then indeed $$\int_0^1 f(x)dx=\lim_{n\to \infty }\frac{1}{n}\sum_{k=1}^n f\left(\frac{k}{n}\right).$$
Now, what happen if $\int_{0^+}^1f$ exist but not $\lim_{x\to 0}f(x)$ ? Do we still have $$\lim_{n\to \infty }\frac{1}{n}\sum_{k=1}^n f\left(\frac{k}{n}\right)\ \ ?$$
I'm thinking for example at $f(x)=\frac{1}{\sqrt x}$. 
 A: Note that since $f$ is continuous on $(0,1]$, then the convergent improper Riemann integral $\int_0^1 f(x)\,dx$ can be written 
$$\int_0^1 f(x)\,dx=\lim_{n\to \infty}\int_{1/n}^1 f(x)\,dx$$
For every $n$ we can subdivide (partition) the interval $[1/n,1]$ such that 
$$\int_{1/n}^1 f(x)\,dx=\sum_{k=1}^{n-1} \int_{k/n}^{(k+1)/n}f(x)\,dx$$
And now we find that using the first mean value theorem for integrals
$$\begin{align}
\lim_{n\to \infty}\int_{1/n}^1 f(x)\,dx&=\lim_{n\to \infty}\sum_{k=1}^{n-1} \int_{k/n}^{(k+1)/n}f(x)\,dx\\\\
&=\lim_{n\to \infty}\frac1n \sum_{k=1}^{n-1} f(\xi_k(n))\tag1
\end{align}$$
where $\xi_k (n)\in [k/n,(k+1)/n]$ depends on $k$ and $n$.  Since, the improper integral converges, the limit on the right-hand side of $(1)$ also converges.  
Thus, there always exists a Riemann sum that converges to the value of the convergent improper integral.  However, it is not always true that the left-sided Riemann sum converges (See Daniel Fischer's solution here for a counter example).

If $f$ is monotonic on $[1/n,1]$, however, we can apply the squeeze theorem to show that we may take any value of $x_k\in [k/n,(k+1)/n]$ and arrive at the desired result 
$$\int_0^1 f(x)\,dx=\lim_{n\to \infty}\frac1n \sum_{k=1}^{n-1} f(k/n)$$


EXAMPLE:  $f(x)=\frac1{\sqrt x}$

As an example, let $f(x)=x^{-1/2}$, which is clearly monotonically decreasing.  Then, we have 
$$\begin{align}
\frac1n\sum_{k=1}^{n-1} \sqrt{\frac{n}{k}}&=\frac{1}{\sqrt{n}}\sum_{k=1}^{n-1} \frac1{\sqrt{k}}=\frac{1}{\sqrt{n}}\sum_{k=0}^{n-2} \frac1{\sqrt{k+1}}
\end{align}$$
We note that $\frac1{\sqrt k}\ge \frac{2}{\sqrt{k}+\sqrt{k+1}}=2\left(\sqrt{k+1}-\sqrt k\right)$ and $\frac1{\sqrt{k+1}}\le \frac{2}{\sqrt{k}+\sqrt{k+1}}=2\left(\sqrt{k+1}-\sqrt k\right)$.  Summing the telescoping terms yields
$$\frac{2(\sqrt{n}-1)}{\sqrt n}<\frac1n\sum_{k=1}^{n-1} \sqrt{\frac{n}{k}}<\frac{2\sqrt{n-1}}{\sqrt n}$$
Letting $n\to \infty$ and applying the squeeze theorem reveals
$$\int_0^1 \frac1{\sqrt x}\,dx=\lim_{n\to\infty}\frac1n\sum_{k=1}^{n-1} \sqrt{\frac{n}{k}}=2$$
as expected!
A: First I'll discuss a situation where the answer is yes: Suppose $f$ is bounded on $(0,1]$ and $f$ is Riemann integrable on $(a,1]$ for each $a\in (0,1).$ (Continuity is not needed.) Then both limits below exist and are equal:
$$\tag 1 \lim_{a\to 0^+} \int_a^1 f(x)\, dx = \lim_{n\to \infty }\frac{1}{n}\sum_{k=1}^n f\left(\frac{k}{n}\right).$$
This is because $f$ extends to be Riemann integrable on $[0,1].$ I'll omit the proof of that for now, but ask questions if you like.
This result can fail if $f$ is not bounded on $(0,1].$ Here's a counterexample: We build a nonnegative $f$ on $(0,1]$ that is essentially a sequence of tall thin triangular spikes. For $n=2,3,\dots $ consider $I_n =[1/n -\epsilon_n,1/n+\epsilon_n],$ where $0<\epsilon_n <1/n^4.$ If the $\epsilon_n$ are small enough, the $I_n$ will be pairwise disjoint subintervals of $(0,1].$ Fix such a choice of $I_n.$ Over each $I_n,$ $f$ will be the upper part of the isoceles triangle of height $n^2$ centered over $I_n;$  thus $f(1/n) = n^2.$ We define $f=0$ everywhere else in $(0,1].$ Note that $f$ is continuous on $(0,1].$
Then the improper integral $\int_0^1 f(x)\,dx$ exists and is finite. In fact we have 
$$\int_0^1 f(x)\,dx = \sum_{k=2}^{\infty}n^2\epsilon_n <\sum_{k=2}^{\infty}\frac{1}{n^2}.$$
However, for each $n,$
$$\frac{1}{n}\sum_{k=1}^n f\left(\frac{k}{n}\right) \ge \frac{1}{n}f(1/n) = n.$$
Thus these sums $\to \infty$ as $n\to \infty,$ and we have a counterexample.
The key here is the wild oscillation of $f$ near $0.$ As several of the answers cited by Mark Viola show, the answer to your question is yes if $f$ is monotone on $(0,1].$ 
A: The following assumes that all integrals being discussed are Riemann integrals.

In order to make sense of the symbol $\int_{a} ^{b} f(x) \, dx$ it is not necessary that $f$ be continuous on $[a, b]$. The only pre-requisite is that $f$ be defined and bounded on $[a, b] $. Moreover the way integration is defined the values of $f$ at a finite number of points in $[a, b] $ do not matter in deciding the integrability of $f$ or the value of its integral.
Thus if $f$ is defined on $[a, b] $ except for a finite number of points then we can redefine $f$ at these points in any manner we want and then discuss its integrability. Such a redefinition does not alter the bounded/unbounded nature of $f$. The requirement of a function $f$ being bounded on $[a, b] $ is only necessary and not sufficient to guarantee its integrability. And there are good number of results (which are in general somewhat difficult to prove) which give necessary and sufficient conditions for integrability of a function and we don't really need to discuss them to answer the current question.
What is needed here is the very definition of integral and it basically says that the Riemann sums of the function $f$ over a partition of $[a, b] $ must tend to a definite limit as the norm (mesh) of partition tends to $0$. Thus by definition if the integral $\int_{0}^{1}f(t)\,dt$ of the question exists then the limit of Riemann sum $$\lim_{n\to\infty} \frac{1}{n}\sum_{k=1}^{n}f(k/n)$$ exists and is equal to the value of the integral irrespective of any limiting behavior of $f$ at $0$.
Your example $f(x) =1/\sqrt{x}$ is unbounded on $[0,1]$ so the above discussion does not apply to it. This function is handled using improper Riemann integration via the definition $$\int_{0}^{1}\frac{dx}{\sqrt{x}}=\lim_{t\to 0^{+}} \int_{t}^{1}\frac{dx}{\sqrt{x}}=2$$ Also note that in this case the usual Riemann sum approach does not work. However under certain circumstances (discussed in other answers) we can show that the limit of Riemann sums also equals the improper Riemann integral. But to emphasize, improper Riemann integrals are not defined as limit of Riemann sums, but rather as limit of limit of Riemann sums and only under certain specific conditions the iterated limit can be equal to usual limit of Riemann sums. 
