Let $M$ be a (compact) manifold and $\lambda$ a closed 1-form on $M$. Under which condition on $\lambda$ does there exists a non-trivial (complex) function $F$ such that
$$dF = F\lambda \quad \quad ?$$
A couple of remarks :
- If the equation above has a solution $f$ and $g$ is some function on $M$, then $e^g f$ is a solution to the equation
$$dF = F(\lambda+dg),$$
so any characterization only depends on the cohomology class of $\lambda$.
- Since this equation can be written locally as $d \ln (F) = \lambda$, the condition that $\lambda$ be closed is natural.
Your question is about what is called Morse-Novikov cohomology. Namely, if you have a manifold $M$ and a closed one-form $\lambda\in\Omega^{1}(M)$, then the following operator is a differential: $$ d_{\lambda}:\Omega^{k}(M)\rightarrow\Omega^{k+1}(M):\beta\mapsto d\beta+\lambda\wedge\beta, $$ i.e. $d_\lambda \circ d_\lambda=0$. The associated cohomology groups $H_{\lambda}^{\bullet}(M)$ are called Morse-Novikov cohomology groups. They arise for instance in the context of locally conformal symplectic (lcs) structures: the form $\lambda$ is then the Lee form, which is defined in terms of the lcs structure.
So you are basically asking what is known about the zeroth Morse-Novikov cohomology group $H_{-\lambda}^{0}(M)$, since $$ dF=F\lambda \Leftrightarrow F\in H_{-\lambda}^{0}(M). $$
I know of 2 interesting statements about this group:
1) Related to your first remark: the groups $H_{\lambda}^{k}(M)$ only depend on the cohomology class $[\lambda]\in H^{1}(M)$. Indeed, if $\lambda'=\lambda+dg$, then we get an isomorphism $$ H_{\lambda'}^{k}(M)\rightarrow H_{\lambda}^{k}(M):[\beta]\mapsto [e^{g}\beta]. $$ In particular, if $\lambda=dg$ is exact then $H_{\lambda}^{0}(M)\cong H^{0}(M)$ as $$ H_{\lambda}^{0}(M)=\{f/e^{g}:f\ \text{constant on connected components of}\ M\}. $$
2) If $\lambda$ is not exact and $M$ is connected, then $H^{0}_{\lambda}(M)=0$. This can be done by showing that, if $F\in H^{0}_{\lambda}(M)$ then $F^{-1}(0)$ is nonempty and both open and closed. It is clearly closed, and it is nonempty since $\lambda$ is not exact (as demonstrated in your second remark). To show that it is open, choose $x\in F^{-1}(0)$ and let $U$ be a neighborhood of $x$ on which $\lambda=dg$ is exact. Setting $h:=e^{g}$, we then have $$ 0=dF|_{U}+F|_{U}dg=dF|_{U}+F|_{U}d(\ln(h))=dF|_{U}+F|_{U}\frac{1}{h}dh. $$ Multiplying by $h$, we get that $d(F|_{U}h)=0$, i.e. $F|_{U}h$ is constant on $U$. But $F(x)=0$ so that $F|_{U}h\equiv 0$. As $h$ is nowhere zero, this implies that $F|_{U}\equiv 0$. So $U$ is an open neighborhood of $x$ that is contained in $F^{-1}(0)$, showing that $F^{-1}(0)$ is open.
These statements, and much more, can be found in the literature. For instance, see Section 2 of https://arxiv.org/pdf/1904.09759.pdf