Let $A$ be a ring and $X$ be an $A$-scheme.
(Hartshorne exercise II.2.17) Suppose there exist $f_0,\dots,f_n\in \mathcal{O}_X(X)$ such that
a) $X_{f_i}:=\{x\in X: f_i(x)\not=0\}\subset X$ is an affine open for all $i$,
b) $(f_0,\dots,f_n)=\mathcal{O}_X(X)$.
Then $X$ is an affine $A$-scheme.
How can I get some intuition for this result? We did the proof on the course I'm taking, but I did not find it illuminating.
Then, I ran into the following exercise:
(Liu exercise 3.8) Suppose there exist $f_0,\dots,f_n\in \mathcal{O}_X(X)$ such that $(f_0,\dots,f_n)=\mathcal{O}_X(X)$.
Then there is a morphism $f:X\to P^n_A=Proj \ A[T_0,\dots,T_n]$ such that $f|_{X_{f_i}}:X_{f_i}\to D_+(T_i)$ is induced by the ring homomorphism $A[T_0/T_i,\dots,T_n/T_i] \to \mathcal{O}_X(X_{f_i}), \frac{T_j}{T_i}\mapsto \frac{f_j}{f_i}$.
How should I understand the conclusion? It must be related to the other exercise, too, but I can only see the superficial similarities. Perhaps it is relevant to say that I'm not very much familiar with classical algebraic geometry.
Also, is it alright to understand the hypothesis $(f_0,\dots,f_n)=\mathcal{O}_X(X)$ as a sort of "there exists a partition of unity"?
Yes, $(f_0,\dotsc,f_n)=(1)$ could be imagined as a "partition of unity".
For the exercise in Hartshorne, one uses the canonical morphism $X \to \mathrm{Spec}(\mathcal{O}_X(X))$ (which exists for every locally ringed space $X$, see EGA I, §1.6). The assumptions say that it is an isomorphism locally on the base, hence an isomorphism.
I don't think that this has a connection to the exercise in Liu. More generally, if $f_0,\dotsc,f_n$ are global generators of an invertible sheaf $\mathcal{L}$ on $X$ (the exercise restricts to $\mathcal{L}=\mathcal{O}_X$, don't know why), then this datum corresponds 1:1 to a morphism of $A$-schemes $f : X \to \mathbb{P}^n_A$ which pulls back the Serre twist $\mathcal{O}(1)$ to $\mathcal{L}$ and correspondingly the canonical global generators $T_0,\dotsc,T_n$ of $\mathcal{O}(1)$ to $f_0,\dotsc,f_n$. This is the well-known description of $\mathbb{P}^n_A$ using its functor of points and actually can be seen as the definition of $\mathbb{P}^n_A$ (EGA I, §9).
If you want to get some intuition for the morphism $f$, look at $k$-valued points for a field $k$ (over $A$) and let's restrict to $\mathcal{L}=\mathcal{O}_X$ as in the exercise (which happens to be the case locally anyway). Then we have $n+1$ global sections of $X$, giving rise to a morphism $X \to \mathbb{A}^{n+1}$. Since they vanish nowhere, this factors over $\mathbb{A}^{n+1} \setminus \{0\}$. Now you just compose with the projection to projective space. Thus, $f(x)=[f_0(x):\dotsc:f_n(x)]$.