Motivation of Localization 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? 
 A: $\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.
A: In classical algebraic geometry, one studies affine algebraic sets, which are the vanishing sets of polynomials.  To do so, we often study functions on these algebraic sets.  There are two types of nice functions in this setting: regular functions and rational functions.
Let $k$ be an algebraically closed field of characteristic zero, and let $\mathbb{A}^n = k^n$ be affine $n$-space over $k$.  An affine algebraic set is the vanishing set of some collection of polynomials, i.e., a set of the form
$$
\mathbb{V}(S) = \{a \in \mathbb{A}^n : f(a) = 0 \ \text{for all} \ f \in S\}
$$
for some $S \subseteq k[x_1, \ldots, x_n]$.  It turns out that sets of this form satisfy the axioms of closed sets, hence can be used to define a topology on $\mathbb{A}^n$, called the Zariski topology.  Given $f \in k[x_1, \ldots, x_n]$, let
$$
D(f) = \mathbb{A}^n \setminus \mathbb{V}(f) = \{a \in \mathbb{A}^n : f(a) \neq 0\} \, .
$$
Then $D(f)$ is a Zariski-open set, called a distinguished open set.  Moreover, the collection $\{D(f) : f \in k[x_1, \ldots, x_n]\}$ forms a basis for the Zariski topology.
Given an algebraic set $V$, the functions that are identically zero on $V$ are elements of the ideal
$$
\mathbb{I}(V) := \{f \in k[x_1, \ldots, x_n] : f(a) = 0 \ \text{for all} \ a \in V\} \, .
$$
Since we want to "throw out" the functions that are identically $0$ on $V$, we define (globally) regular functions on $V$ as elements of the ring $k[V] := k[x_1, \ldots, x_n]/\mathbb{I}(V)$, called the coordinate ring of $V$.  If $V$ is an irreducible algebraic set (aka, an irreducible variety), then $\mathbb{I}(V)$ is prime.  Then $k[V]$ is an integral domain, so we can form its fraction field $k(V)$, called the function field of $V$, and whose elements are called rational functions on $V$.  Since a rational function is a ratio of regular functions, it will not usually be defined everywhere on $V$: it will be undefined at a point if its denominator vanishes there.  If a rational function $f$ is  defined at a point $a \in V$, we say that that $f$ is regular at $a$.
Suppose we are interested in studying the local properties of functions near a point $a \in V$.  Since these properties are "local," we can restrict our attention to a distinguished open subset of $a$, which is of the form $D(f) \cap V$.  What are the rational functions that are regular at all points of $D(f)$?  Well, since $f \neq 0$ on $D(f)$, we can certainly allow $f$ as a denominator.  It turns out that the answer is exactly $k[V]_f := k[V][1/f]$, the localization of $k[V]$ at the multiplicative set $\{1, f, f^2, \ldots \}$.
Suppose instead we want to study a subvariety $W \subseteq V$.  $W$ will be defined by a prime ideal $\mathfrak{p} \trianglelefteq k[V]$.  We can study the functions on $W$ by studying the functions on $V$, but we want to exclude those functions that are undefined at all points of $W$, i.e., functions whose denominators are in $\mathfrak{p}$.  Thus we consider rational functions whose denominators are not contained in $\mathfrak{p}$.  These are exactly the elements of the localization $k[V]_\mathfrak{p} := S^{-1} k[V]$, where $S = k[V] \setminus \mathfrak{p}$.
In summary, by restricting our attention from $V$ to $D(f) \cap V$, we expanded the collection of regular functions from $k[V]$ to $k[V]_f$ by localizing.  When we restricted to an even smaller subset $W \subseteq V$, we got an even larger collection of regular functions $k[V]_{\mathfrak{p}}$.  For more on this, I recommend Chapter 2 of David Eisenbud's Commutative Algebra: with a View Toward Algebraic Geometry.
As a last note, this idea persists into the scheme-theoretic approach to algebraic geometry.  When defining schemes, Grothendieck begins by defining the structure sheaf on an affine scheme $X = \operatorname{Spec}(R)$, and he does so by letting $\mathcal{O}_X(D(f)) = R_f$ on the basis of distinguished open sets (where the definition of "distinguished open set" has been appropriately modified).
