What is an algebraic variety? I'm studying abelian varieties from Milne's book, but I'm having difficulty juggling different conventions and definitions of basic concepts, like those of algebraic and projective varieties. First, let me write some terminology the way I understand it. 
Classically, an affine $k$-variety is a Zariski closed (zero set of some family of polynomial), irreducible subset of $k^n$ where $k$ is any field, and an affine algebraic set is just any Zariski closed subset. A projective $k$-variety is a Zariski closed (zero set of some family of homogeneous polynomials) subset of $\mathbb P^n$. 
The definition of an algebraic ($k$-)variety is somewhat more delicate. According to Milne's Algebraic Geometry notes, an affine $k$-variety is any locally ringed space isomorphic to some $(V,\mathcal{O}_V)$ where $V$ is affine algebraic and $\mathcal{O}_V(U)$ is the set of regular functions on $U$ (rational functions with a denominator that doesn't vanish on $U$). First question: how is this definition of an affine $k$-variety related to the one above? 
Next, Milne defines an algebraic prevariety over $k$ as a locally ringed space admitting a finite open cover of affine $k$-varieties, and then an algebraic $k$-variety is a separated algebraic prevariety over $k$. What confuses me with this definition is that I don't recognize a scheme structure on Milne's definition of a variety. My second question is, is it true that the affine $k$-varieties $(V,\mathcal{O}_V)$ are affine (k-)schemes. In particular, to what ring $R$ is $(V,\mathcal{O}_V)$ isomorphic to $\operatorname{Spec} R$?
Finally, Qing Liu's definition of an algebraic $k$-variety is as follows. An affine $k$-variety is "the affine scheme associated to a finitely generated (reduced) $k$-aglebra". Which affine scheme is this? Is it simply $\operatorname{Spec} k[T_1,\dots,T_n]/I$ with $I$ radical? How does one make this association precise? Finally, Liu's algebraic $k$-variety is a $k$-scheme admitting an finite cover of affine $k$-varieties. 
I suppose the ultimate question is this. What is the relationship between affine algebraic sets in $k^n$, sheaves of reduced, finitely-generated $k$-algebras, and the scheme $\operatorname{Spec}k[T_1,\dots,T_n]/I$ where $I$ is a radical ideal, and what does it mean for a variety to be affine or projective in these contexts? 
 A: Let me give a brief clarification, in order to avoid misunderstandings :    
1) The elementary approach pioneered in Serre's FAC and described in Milne only works if the base field $k$ is algebraically closed and it completely breaks down if $k$ is not algebraically closed.
One of the main advantages of Grothendieck's scheme approach is that it allows us to speak reasonably of the subscheme $x^2+y^2+1=0$ of $\mathbb A^2_\mathbb Q$  which is infinite, although of course the set of points in  $\mathbb Q^2$ satisfying that equation is empty.
The elementary approach cannot handle this situation.
2) Given a reduced finitely generated $k$-algebra $A$, the elementary approach consists in replacing $X=\operatorname {Spec}A$ by the restriction $(V,\mathcal O_V)$ of $X$ to the subspace $V=\operatorname {Specmax}A$ of maximal primes of $A$, and endowing that space with the restriction of the structural sheaf of $X$: $\mathcal O_V=\mathcal O_X\vert V$.
Of course $V$ is very different from $X$: all its points are closed and in particular $V$ has no generic point.
However one still has $\mathcal O_V(V)=\mathcal O_X(X)=A$ and all the information contained in $X$ is saved in $(V,\mathcal O_V)$.
This assertion is translated technically into the theorem that the map $X\mapsto V$ is an equivalence of categories.
Its quasi-inverse is a bit more difficult to explain: the description is in Hartshorne's Proposition II.6 . 
A: Each one of these definitions is morally just a restricted version of each of the more general definitions. To be precise, there are fully faithful functors from the less general definitions to the more general definitions which in some cases are equivalences of categories. Let's rewrite the definitions here so we have a quick reference. We'll cover the affine case first and then explain how to patch everything together to the global case afterwards.

"Classical" definition (affine case): A $k$-variety is an irreducible Zariski-closed subset of $k^n$ for an algebraically closed field $k$ and some integer $n$.
Milne's definition (affine $k$-variety): An affine $k$-variety is a locally ringed space isomorphic to $(V,\mathcal{O}_V)$ where $V\subset k^n$ is a "classical" $k$-variety and $\mathcal{O}_V$ is the sheaf of regular functions on $V$.
Liu's definition: An affine $k$-variety is the affine scheme $\operatorname{Spec} A$ associated to a finitely generated reduced $k$-algebra $A$.
General definition: An affine $k$-variety is $\operatorname{Spec} A$ for a finitely generated $k$-algebra $A$.

Basically what's going on here is that each of these definitions is slowly, grudgingly accepting greater generality and more extensible structure on the road to the general definition.
Milne's definition adds the structure sheaf, but is not yet all the way to a scheme - it's missing generic points. This in particular shows that generally $(V,\mathcal{O}_V)$ is not the spectrum of a ring. (Milne's definition is set up in such a way that there's only one way to get the structure sheaf, so there's an equivalence of categories between the "classical" category and Milne's category.)
From here, Liu's definition adds the generic points - there is a fully faithful functor between Milne's definition and Liu's definition, which has image exactly the irreducible varieties in Liu's definition.
The road from Liu's definition to the general definition is easy: we stop requiring reducedness, which is a technical advantage for some more advanced properties one may wish to consider later on (eg those involving cohomology).
The proof that there are fully faithful functors between all these definitions can be found (among other places) in Hartshorne II.2.6:

Proposition (Hartshorne II.2.6): Let $k$ be an algebraically closed field. There is a natural fully faithful functor $t:\mathfrak{Var}(k)\to \mathfrak{Sch}(k)$ from the category of varieties over $k$ to schemes over $k$. For any variety $V$, it's topological space is homeomorphic to the closed points of the underlying topological space of $t(V)$, and it's sheaf of regular functions is obtained by restricting the structure sheaf of $t(V)$ via this homeomorphism.

The idea of the proof is that one can add the generic points of each irreducible positive-dimensional closed subset and then construct the structure sheaf on this new space in a canonical way, which produces for you a scheme verifying the properties claimed. (In case you're wondering about Hartshorne's definition, Hartshorne defines his category of varieties as quasiprojective integral varieties, of which the affine varieties of the "classical" and Milne's definitions are full subcategories. This same idea of the proof works in all cases.)
This provides us the answer to the first part of your main question: there are fully faithful functors which lets you consider each category as a part of the next more general category. This means that you can generalize without fear.

Now we can talk about gluing and non-affine varieties. In full generality, just like a manifold is some space locally modeled on $\Bbb R^n$, we should have that varieties are locally modeled on affine varieties (and schemes are locally modeled on affine schemes). This is what Milne's getting at with his definition of a prevariety, and what Liu is getting at with the finite cover condition.
There are some pathologies one may wish to avoid, like the line with two origins, which one can get by gluing to copies of $\Bbb A^1$ along the open sets which are the complements of the origin in each copy. Such varieties are non-separated, and that's what the separated condition in Milne's "algebraic $k$-varieties" excludes.
The most general definition one normally sees of a variety over a field is the following:

Most general definition: A $k$-variety is a scheme of finite type over the field $k$.

This allows non-reduced, non-irreducible, non-separated schemes, but keeps the essential finiteness condition of "finite type", which implies that any $k$-variety has a finite cover by affine open $k$-varieties, which is exactly the finiteness condition that Liu and Milne both require. Be warned that many modern authors of papers will take this general definition plus some adjectives, and are not always clear on which adjectives they take. (If you're writing papers in algebraic geometry, please include a sentence in your conventions section which makes it clear what adjectives you take when you write "variety"!)
In this most general situation, affineness and projectiveness are easy to describe. Each is exactly the condition that our variety admits a closed embedding in to $\Bbb A^n_k$ or $\Bbb P^n_k$, respectively, for some $n$. (To connect this with the affine definition as $\operatorname{Spec} A$ of a finitely-generated $k$-algebra, note that we can choose a surjection $k[x_1,\cdots,x_n]\to A$, which gives us $A\cong k[x_1,\cdots,x_n]/I$ for some ideal $I$, and this exactly shows us that $\operatorname{Spec} A \to \operatorname{Spec} k[x_1,\cdots,x_n]=\Bbb A^n_k$ is a closed immersion.)
