Consider infinity in codomain of rational function if field is algebraically closed In Example 2.3.4 on pg. 43 of Algebraic Geometry and Arithmetic Curves by Qing Liu, it says

If $k$ is algebraically closed, we can consider a rational function as a function $k \rightarrow k \cup \{+\infty\}$.

Why is it important that the field be algebraically closed?
 A: There is the concrete problem that if $k$ is a finite field, there are only finitely many functions from $k \to k \cup {\infty}$, while the field $k(t)$ of rational functions is infinite. So the identification doesn't make sense, because it is not injective. 
Requiring to work over an algebraically closed field is one way to fix this problem, though you can also be content with an infinite efield. Generally the philosophy is that if your base field is not algebraically closed, you have secret points that are seen from a finite extension of your base field. What is a $L$ point in $Spec A$ but a map $A \to L$? Take $A = \mathbb{Q}[t]$ and you will get points over $\mathbb{Q}(\sqrt{2})$ (and the evaluation of $f(t)$ at this point is just $f(\sqrt{2})$ or $f(-\sqrt{2})$? Brain teaser.)... but still a function $f \in A$ is determined by $f(x)$ for $x \in \mathbb{Q}$.
(The hint for why infinite fields work is that if a polynomial of degree $\leq n$ in $k[t]$ has $n + 1$ zeros in $k$, then it is the zero polynomial.)
