First part of the proof of "The Jouanolou trick" Let me state the Jouanolou trick first: (throughout the field is $k$, which is algebraically closed)
For any projective variety $X$, there is an affine variety $Y$ and an onto map $Y\to X$ such the fibers of this map are isomorphic to an affine space, $\mathbb{A}^N$.
Actually the proof of the above proposition is pretty simple once we prove the following:
Denote by $Y$ the set of idempotent $n\times n$ matrices $M^2=M$ (i.e. $M\in \mathrm{Mat}_n(k)$), such that $\mathrm{rank}(M)=1$. Then $Y$ is an affine variety (closed subvariety of $M\in \mathrm{Mat}_n(k)\equiv \mathbb{A}^{n^2}$).
First of all $M^2=M$ gives $n^2$ polynomial equations restricting the matrices to only idempotent ones. So it only remains to impose the $\mathrm{rank}(M)=1$ condition. This is basically where I got stuck:

How to implement $\mathrm{rank}(M)=1$ on a matrix using only polynomial equations?

1st Attempt:  I argued (at first) that $\mathrm{rank}(M)=1$ means that the characteristic polynomial is $x^{n-1}(x-1)$, so it should be enough to demand $M^{n-1}(M-1)=0$ by Cayley-Hamilton. But this is nothing new since if $\mathrm{rank}(M)\neq 0, n$ and $M^2=M$, then in general $M^{m}(M-1)^{n-m}=M(M-1)$.
2nd Attempt: I demanded $\det (1-M)=0$ and $\det M=0$, this restricts rank of $M$ to $0<\mathrm{rank}(M)<n$. But this isn't going anywhere either.
3rd Attempt: Suppose $M$ is of rank one. Construct a $2\times n$ matrix $N(i,j)$ having the $i$th row of $M$ as its first row and the $j$th row of $M$ as its second row. Now $\mathrm{rank}(N(i,j))$ is either zero or one. Meaning the rows of $N(i,j)$ are linearly dependent. So we have a polynomial relating these rows together. Doing it for all the pairs of rows imposes rank one condition completely. But then I realized, these polynomials are heavily dependent on the specific form of $M$, so again they are no good either.
Any hints about how to implement $\mathrm{rank}(M)=1$ on a matrix using a polynomial equation?
 A: Here is a beautiful geometric illustration of Jouanoulou's trick, suggested by a friend of mine, in the simplest case where $X=\mathbb P^1$.    
The rank $1$ projections $M=M^2: k^2\to k^2$ correspond exactly to distinct ordered pairs $(K,I)$ of one dimensional vector subspaces $K,I\subset k^2$.
The bijective correspondence is simply given by $\operatorname {Ker}(M)=K$ and $\operatorname {Im}(M)=I$.
But these pairs form  the variety $Y=\mathbb P^1\times\mathbb P^1\setminus \Delta $, where $\Delta \subset \mathbb P^1\times\mathbb P^1$ is the set of pairs $(L,L)$ consisting of twice the same line $L\subset k^2$.
This set $Y$ is affine. Here is why:  
The Segre map $$\mathbb P^1\times\mathbb P^1\to \mathbb P^3: ([x_0,x_1],[y_0,y_1])\mapsto [z_0=x_0y_0,z_1=x_0y_1,z_2=x_1y_0,z_3=x_1y_1]$$ (whose image is the smooth quadric $z_0z_3-z_1z_2=0$) sends $Y$ isomorphically onto the closed subset $Y' =V(z_0z_3-z_1z_2)\cap U\subset U$ of the open subset $U=\mathbb P^3\setminus V(z_1-z_2)$ .
 But this open set $U$ is isomorphic to $\mathbb A^3$ (since it is the complement of a hyperplane in $\mathbb P^3$) and thus $Y'\subset U$ is affine.    
Conclusion: The variety $Y$ (which is isomorphic to $Y'$) is affine, isomorphic to a closed smooth quadric surface in $\mathbb A^3.$  
Edit:  I forgot to say that the morphism $f:Y\to X=\mathbb P^1=\mathbb P(k^2)$   is given by $(K,L)\mapsto K$ .
The fiber $f^{-1}(K)$ consists of all the pairs $(K,L)$ with $L\neq K\subset k^2$ and is thus a closed subset  $f^{-1}(K)\subset Y$ isomorphic to $\mathbb A^1$.
Hence we obtain a locally trivial bundle $f:Y\to X=\mathbb P^1$ with total space an affine variety and  with fiber $\mathbb A^1$, 
but which   cannot be made into  a vector bundle because it has no section.
   [Because the image of that section would be a projective line embedded in the affine variety $Y$ : utter nonsense !].
Quite interesting this Jouanolou trick, isn't it?
