Thanks to the comments of George Lowther and Greg Martin (for which I am most grateful), I can now show that the answer is YES for infinitely many primes $q$.

**Theorem 1.** Let $t_1\dots,t_{n-1}$ be any finite set of real numbers.Then for any $\epsilon>0$ and any integer $r>0$ there are infinitely many primes $q\equiv 1\pmod{r}$ such that
$$\|(q-1)t_i\|<\epsilon,\qquad i=1,\dots,n-1.\tag{1}$$
Here $\|x\|$ stands for the distance of $x$ to the nearest integer.

**Proof.** Without loss of generality, the numbers $1,t_1,\dots,t_{n-1}$ are linearly independent over $\mathbb{Q}$. Indeed, we can express each of them as a $\mathbb{Z}$-linear combination from a suitable basis $\frac{1}{s},t_1^*,\dots,t_{m-1}^*$ of their $\mathbb{Q}$-linear span, where $s>0$ is an integer. Then the statement for $t_1,\dots,t_{n-1}$ follows from the statement for $t_1^*,\dots,t_{m-1}^*$ (with $\mathrm{lcm}(r,s)$ in place of $r$). When the elements of $1,t_1,\dots,t_{n-1}$ are linearly independent over $\mathbb{Q}$,
the statement follows from the stronger result that the vectors $(qt_1,\dots,qt_{n-1})$ are dense modulo $1$, as $q$ runs through the primes such that $q\equiv 1\pmod{r}$. This result is essentially due to Vinogradov, with technical improvements by Vaughan and Harman. See Theorem 4 in Harman: Diophantine approximation with primes, J. London Math. Soc. (2) 39 (1989), 405–413. Well, Harman does not have the condition $q\equiv 1\pmod{r}$, but it seems straightforward to incorporate it.

**Theorem 2.** Let $t_i$, $f_i$, $F$ be as in the original question but without the assumption $f_i\in\mathbb{Z}$. Then for any $\epsilon>0$ there is a prime $q$ such that
$$\left|\sum_{j=1}^{q-1}F\left(\frac{j}{q}\right)\right|<
\epsilon.$$
In particular, if $F$ is integer valued and $\epsilon=1$, then the left hand side is zero.

**Proof.** Assume that $\epsilon>0$ is sufficiently small, namely
$$\epsilon<\|t_i\|,\qquad i=1,\dots,n-1.\tag{2}$$
By Theorem 1, there is a prime $q$ such that (1) holds.
Observe that
$$\sum_{j=1}^{q-1}F\left(\frac{j}{q}\right)=\sum_{i=0}^{n-2}f_i\bigl([qt_{i+1}]-[qt_i]\bigr)+f_{n-1}\bigl(q-1-[qt_{n-1}]\bigr),$$
where $[x]$ stands for the integral part of $x$. Here we used that no $\frac{j}{q}$ coincides with any $t_i$, as follows from (1) and (2). We subtract
$$0=(q-1)\int_0^1 F(t)dt=\sum_{i=0}^{n-1}f_i\bigl((q-1)t_{i+1}-(q-1)t_i\bigr),$$
then with the notation
$$\tilde t_i:=[qt_i]-(q-1)t_i,\qquad i=0,\dots,n-1,$$
we get
$$\sum_{j=1}^{q-1}F\left(\frac{j}{q}\right)=\sum_{i=0}^{n-2}f_i\bigl(\tilde t_{i+1}-\tilde t_i\bigr)-f_{n-1}\tilde t_{n-1}=\sum_{i=1}^{n-1}(f_{i-1}-f_i)\tilde t_i.$$
By (1) we can write $(q-1)t_i=n_i+e_i$ with $n_i\in\mathbb{Z}$ and $|e_i|<\epsilon$. Then
$$qt_i = n_i+t_i+e_i,\qquad i=1,\dots,n-1,$$
whence by (2), that is by $\epsilon<\min(t_1,1-t_{n-1})$, we have
$[qt_i]=n_i$, so that $\tilde t_i=-e_i$. It follows that
$$\sum_{j=1}^{q-1}F\left(\frac{j}{q}\right)=\sum_{i=1}^{n-1}(f_i-f_{i-1})e_i,$$
whence
$$\left|\sum_{j=1}^{q-1}F\left(\frac{j}{q}\right)\right|<\epsilon\sum_{i=1}^{n-1}|f_i-f_{i-1}|.$$
The right hand side can be made arbitrary small, so we are done.

integers$m$ such that $\sum_{i=1}^{m-1} F(i/m) = 0$? $\endgroup$3more comments