Has this problem been studied? Today in Italy all students under 18 faced with a test used to establish the quality of the schools they are in. I read one of the question (a mathematical question, of course!) that make me thing for a while. Here is the question:
"Prove or disprove that $n^2 + n + 1$ is a prime number for all positive integers n."
After a while, you are easily convinced that there are some $n$ such that $n^2+n+1$ is not prime. Indeed, taking $n=4$, we get $n^2+n+1 = 21 = 3 \cdot 7$, which is not prime.
This reading made me think about this problem:
What properties do all $n$, such that $n^2+n+1$ is prime, share?
or equivalently
What properties do all $n$, such that $n^2+n+1$ is not prime, share?
The problem has a really simple formulation and then I start wondering that someone already studied this. Is it true? Are there some references about it?

Questions about prime numbers and polynomials along the lines of your first question tend to be deep, and consequently very hard. One such question, a special case of the Bunyakovsky conjecture, asks whether the polynomial $n^2+1$ assumes infinitely many prime values; we don't have an answer. The current state of mathematical understanding is far removed from being able to answer your first question.
Your second question is easier to attack: we can classify some of the ways in which the polynomial $n^2+n+1$ fails to output primes, using modular arithmetic. More specifically, if you can find a number $d$ and a root of the polynomial $n^2+n+1$ modulo $d$ then you have found an infinite (linear) family of outputs of the polynomial which are not prime. For example,


*

*$n\equiv1\bmod3\implies3\mid n^2 + n + 1$.

*$n\equiv 2\bmod7$ or $n\equiv4\bmod7$ $\implies7\mid n^2+n+1$.

