TITLE: Motivation of Localization
QUESTION [11 upvotes]: In the context of commutative algebra, localization at a prime ideal was inspired by ideas of algebraic geometry. Some author said that it just like "take a small neighborhood". But what does this exactly mean?

REPLY [4 votes]: $\newcommand{\Spec}{\operatorname{Spec}}$Let's start with the idea of "just looking at functions in small neighborhoods of a point". 
Motivational Example: Let $X$ be a topological space and for each open $U\subseteq X$, let $\mathcal O(U)$ be the collection of continuous maps $X\to\Bbb R$. These maps have the following nice property:

$(*)$ Given open $U\subseteq X$, and an open cover $U=\cup_i U_i$, along with an element $f_i\in\mathcal O(U_i)$ for each $i$, such that $f_i|_{U_i\cap U_j}=f_j|_{U_i\cap U_j}$ for all $i,j$, then there is a unique map $f\in\mathcal O(U)$ such that $f|_{U_i}=f_i$.

Now, for any point $x\in\Bbb R$, we can consider the collection $\{(f,U)\mid f\in\mathcal O(U)\}$, with the following equivalence relation: $(f,U)\sim(g,V)$ if there exists some $W\subseteq U\cap V$ such that $f|_W=g|_W$. We denote this collection with the equivalence relation by $\mathcal O_x$, and it is called the stalk at $x$.
The point of the previous definition is that it gives us a convenient language for describing when two functions are the same "on an arbitrarily small neighborhood of $x$".
How does this relate to prime ideals?
Well first, we remark that on any topological space, if we have a collection of "functions" on each open subset satisfying condition $(*)$, we call this a sheaf (look up the wikipedia entry if you'd like the very precise definition). We can also define for any sheaf $\mathcal O$ on $X$ and point $x\in X$ the stalk $\mathcal O_x$ in the exact same way we defined it before.
Now, it turns out that if we let $\Spec A$ denote the set of prime ideals of $A$, where $A$ is a commutative ring with $1$, then there is actually a natural topology on this set, called the Zariski topology. Furthermore, there is a natural sheaf structure on $\Spec A$, where the "functions" on certain open subsets is given by certain localizations of $A$. Interesting!
Now, since we have a sheaf on $\Spec A$, we can consider the stalk at a prime ideal $\mathfrak p$, i.e. a point of $\Spec A$. It turns out that this stalk is precisely equal to $A_{\mathfrak p}$, the localization at $\mathfrak p$! So this ring $A_{\mathfrak p}$ in some way corresponds to "functions in arbitrarily small neighborhoods of $\mathfrak p$".
I hope this helps! Let me know if I can expand on anything.