Let $K$ be a field. If we have a polynomial ring, $K[X_1,...,X_n]$, and an ideal $I$, we can form the quotient ring, $$K[X_1,...,X_n]/I.$$ For a given ideal, $I$, if we take an element of this quotient ring, when is it well defined as a function?
For instance, consider $$\mathbb{C}[X]/(X^2 -1).$$ Then, for example, in this ring, we have that (the images of) $f(X) = 4(X^2 -1) + 2X$, and $g(X) = 2X$ are equal. However, $\overline{F}(p) = \overline{G}(p)$ if and only if $p = \pm 1$. Of course, the "canonical" representation of this element in $\mathbb{C}[X]/(X^2 -1)$ is $\overline{g}(X)$, but $\overline{f}(X)$ is an equally valid representation.
However, if we let $V \subset \mathbb{A}^n(K)$, and define $$I(V) = \{F \in K[X_1,...,X_n] : F(p) = 0, \forall p \in V\},$$ then elements of $$\Gamma(V) = K[X_1,...,X_n]/I(V)$$ are well defined on $V$, since if $f,g \in K[X_1,...,X_n]$ such that $\overline{f}=\overline{g}$, then $f-g \in I(v)$, so $f(g) = g(p)$. I am also aware that there is an isomorphism between $K[X_1,...,X_n]/I(v)$ and polynomial functions from $V$ to $K$.
I've come across the above problem whilst studying algebraic geometry (local rings, poles, etc.). I feel my problem is a matter of perception. Should elements of $K[X_1,...,X_n]/I$ just be viewed formally? Does it only work out nicely in the latter case because of the stated isomorphism?
The answer has already been given by sebigu (and yourself), but let me elaborate a little bit.
Take an ideal $I \subset K[X_1,\ldots,X_n]$, consider the quotient ring $R = K[X_1,\ldots,X_n]/I$. Take an element $f\in R$.
Well, $f$ is just an element of $R$, nothing more. But $f$ defines a function $\Phi: V(I) \rightarrow K$, where $V(I)\subset\mathbb A^n$ is the affine algebraic subset defined by $I$. How? Choose a representative $F$ of $f$ in $K[X_1,\ldots,X_n]$ ($F$ is just a polynomial with coefficients in $K$); for every $x = (x_1,\ldots,x_n)\in V(I)$, put the coordinates of $x$ in the polynomial $F$, and get a "value" $F(x)\in K$.
A priori, $F(x)$ might depend on your choice of $F$. But if you take another representative $F'$ of $f$, and call $G = F-F'$ their difference. By definition of quotient ring, $G$ belongs to the ideal $I$. By definition of $V(I)$, $G(x) = 0$, since $x \in V(I)$. Therefore, $F(x) = F'(x)$ and the "value" does not depend on the choice of the representative $F$. The function $\Phi:V(I) \rightarrow K$ is well-defined.
I think your confusion arises from identifying $f$ and $\Phi$ (often they will be denoted by the same symbol!): keep in mind that $f$ is an element of the quotient ring, $\Phi$ is a function. They are quite different things!
In your example, $f = 4(X^2-1) + 2X$ and $g = 2X$ are the same element of $\mathbb C[X]/(X^2-1)$: $f = g$ (because their difference lies in the ideal $I=(X^2-1)$). This element $f$ defines a function $\Phi:V(I) \rightarrow \mathbb C$.
What is $V(I)$ here? Well, $V(I)\subset \mathbb A^1$ is just the union $\{-1\}\cup\{1\}$. The function $\Phi$ is well-defined in these two points and nowhere else.
Hope this helped.