Sufficient conditions to tell whether a surface contains a line I am interested in the following fairly general question: given an affine surface defined by $f(x_1, x_2, x_3) = 0$ for some polynomial $f$ in three variables, when can one say that the surface defined will not contain a line? What if we consider the projective case when $f(x_1, x_2, x_3, x_4) = 0$ with $f$ a homogeneous polynomial in four variables?
More specifically, I am interested in the special case when $f$ (in both cases) have integer coefficients, and when $f = 0$ does not contain any lines with rational slope, or does not contain lines that contain any rational coordinates.
 A: For simplicity I assume that your surface $X$ is smooth and projective.
For $d>3$ the following strategy often works:
First of all you compute the (geometric) Picard number rank $Pic(X_{\overline{\mathbb{Q}}})$.
The Picard number can be bounded by data coming from the zeta functions of reductions of $X$ modulo several primes. (See Ronald van Luijk's paper on a K3 surface with Picard number one.)
If you can conclude from these bounds that Picard number is one then you are done (as pointed out by Daniel). 
Otherwise you start to look for divisors $D_1,\dots, D_\rho$ on $X$ that span $Pic(X_{\overline{\mathbb{Q}}})\otimes \mathbb{Q}$. (A computer can do this for you, at least in theory.)
Once you find such a basis you calculate the intersection matrix of the $D_i$. You can also calculate the hypothetical intersection number of the $D_i$ with a line and lattice theory may exclude the possibility that the multiple of a line is contained in the subgroup generated by the $D_i$. (In the above mentioned paper of Van Luijk there is an example with $\rho=2$ where the possibility of a line is excluded.)
For $d<4$ your problem is purely arithmetic. For $d=1$ the problem is trivial. For $d=2$ you have to determine whether the two rulings are defined over $\mathbb{Q}$ or not. This can be done easily. For $d=3$ you need to find all the 27 lines and determine whether one of them is rational. The problem you encounter here is that for a general cubic surface each of the 27 lines is defined over a big extension. So in practice it is hard to show that none of the lines is defined over the rationals.
A: Perhaps this is not a good answer; but I am not sure if there exists a better one.
This polynomial should be represented in a form $f=k_1f_1+k_2f_2$, where $k_1$, $k_2$ are two linear functions (such that their common zeroes form a line), $f_1$ and $f_2$ are the polynomials of degree $\leq d-1$. If such representation exists, your surface surely contains a line $k_1=k_2=0$.
Backwards, assume that such a line exists; after the coordinate change, this line is $x_1=x_2=0$. Writing $f$ as $f=x_1f_1(x_1,x_2,x_3)+x_2f_2(x_2,x_3)+f_3(x_3)$ we see that $f_3(x_3)=0$, thus obtaining a desired representation.
The answer for the projective case is just the same; of course, now the linear functions should be homogeneous.
