Find an ideal $I$ of $\mathbb Z/2\mathbb Z[x]$, such that $\mathbb Z/2\mathbb Z[x]/I$ is a field of 8 elements. My attempt:

A field can be constructed by taking the quotient by a maximal ideal.
  $\mathbb Z/2\mathbb Z[x]$ is a PID, so a maximal ideal can be made by
  taking an ideal generated by an irreducible.
$x^3+x+1$ is irreducible. (I checked by cases. Is there a better
  method?)
Then $\mathbb Z/2\mathbb Z[x]/(x^3+x+1)$ consists of elements of the form $\delta_1 x^2+\delta_2 x+\delta_3, \delta_i=0$ or
  $1$. This is because the polynomials of degree greater than 2 get
  simplified by the relation $x^3=x+1$. Thus we have $2^3$ elements in
  our field.

Is my solution correct? I feel like the first sentence in the last paragraph (starting with Then) is not that precise. Also, to generalize this question, in $\mathbb Z/p\mathbb Z[x]$, to find a field of size $p^n$, can I use the maximal ideal $(x^n+x+1)$?
 A: Yes you are correct in $p = 2$. For odd prime $p$, it may not be true, for example take $p = 5$, then $f(x) = x^{5} + x + 1$ has a zero in $\mathbb{F}_{5}$ namely class of $2$, i.e. $f(2) = 0 $ in  $\mathbb{F}_{5}$. So $f$ is not irreducible.
A: I think your solution is correct.   The polynomial is irreducible because there are no roots.  Indeed we get a $\Bbb Z_2$ vector space with basis $\{1,x,x^2\}$.
As to whether it generalises, I don't know if $x^n+x+1$ is irreducible in $\Bbb Z_p$.   Is it?  
For instance,  if $p=3$, then it's not.  So you apparently need some more restrictions.  
A: Your solution for the case $p=2$ is correct. 
Concerning a better method for checking that $x^3+x+1$, another one could be to check if any of the elements $\{0,1\}$ is a root: if a polynomial of degree 3 is reducible, then it will at least factor as a product of a polynomial of degree one and one of degree two. 
Concerning the conclusion (the sentence after "then") it is correct as well. If you want to be a bit more formal, you may prove that the assignment
$$\mathbb{Z}_2\times \mathbb{Z}_2\times \mathbb{Z}_2\to \mathbb{Z}_2[x]/(x^3+x+1)$$
given by $(a,b,c)\mapsto ax^2+bx+c$ is bijective. This will tell you that your field has $2^3$ elements (caveat: not that $\mathbb{Z}_2[x]/(x^3+x+1)$ is a field! That you know because you are quotienting a commutative unital ring by a maximal ideal. In fact, $\mathbb{Z}_2\times \mathbb{Z}_2\times \mathbb{Z}_2$ is not a field and the assignment above is not multiplicative, it is just $\mathbb{Z}_2$ linear).
Concerning the general question, I suspect you want to have that $x^n+x+1$ is irreducible to have a field with $p^n$ elements. If that's the case then yes, you can do that. However, in general, I don't think that's the correct polynomial you want to look at. Have a look at this answer.
