geometric motivation for spaces with functions 
Let $k$ be a field.
  A space with functions over $k$ is topological space X together with a family $O_X$ of k-subalgebras $O_X(U)\subseteq Map(U,k)$ for every open set $U$ that satisfy
a) If $U\subseteq V$ are two open sets and $f\in O_X(V)$, then $f$ restricted to $U$ is in $O_X(U)$
b) (Axiom of gluing) Given open sets $U_i \subseteq X$ for $i\in I$ and $f_i \in O_X(U_i)$ for $i\in I$ with $$f\restriction_{U_i\bigcap U_j}=f_j\restriction_{U_i\bigcap U_j}$$ for any $i,j \in I$, then there exists a unique function $f: \bigcup _i U_i \to k$ with $f\restriction_{U_i}=f_i$ for any $i\in I$ and $f\in O_X(\bigcup _i U_i)$.

Since I had a nice introduction in commutative algebra, I worked through the first chapter of Wedhorn and Görtz's book about algebraic geometry. Unfortunately I haven't any descent knowledge in geometry, so I can't really imagine what's really about the notion of spaces of functions. I read in the book, that the notion is motivated by the notion of a manifold and the realed-valued continous maps on its opens sets. 
I suppose with the k-valued maps we can analyse the geometric structure of the topological space, although I can't really imagine how that really should work. 

Can you give me some examples, especially from "classical" algbraic geometry (i.e. where X is a algebraic variety)? 

new (more precisely) questions:

For a geometric object (such as a manifold or variety), can be the properties of the functions on the open sets interpreted as geometric properties of the object and vice versa?
Are geometric properties of a object even formulated in the terms of functions on the open sets?

Maybe a example for the first question, which would also fit (in some way) the idea in the second question: A point on algebraic variety is non-singular iff the localization of affine coordinate ring at the corresponding maximal ideal of the point is regular. 
 A: This is a special case of the notion of a ringed space, which should be seen as an abstract framework for doing geometry. It is motivated by many specific examples. Any topological space has its ring of continuous functions (say, real-valued), actually for every open subset. One can easily check that a),b) are satisfied, namely continuous functions can be glued. Another example: Any smooth manifold is not just a topological space, but also comes equipped with its rings smooth of smooth functions on its open subsets. Again it is easy to check that a),b) hold. Now, if we take a variety in the sense of classical algebraic geometry, then we have the notion of a regular function. Locally these are fractions of polynomial functions. Because their definition is local, it is again trivial to check a),b).
Here is an example: Consider the projective line $\mathbb{P}^1$ (in variables $x,y$) with the two standard open subsets $\{x \neq 0\}$ and $\{y \neq 0\}$. These are copies of the affine line. Their rings of regular functions are $k[\frac{y}{x}]$ and $k[\frac{x}{y}]$. We have regular functions $y/x$ on $\{x \neq 0\}$ and $x/y$ on $\{y \neq 0\}$. These don't coincide on the intersection, hence don't glue a regular function on $\mathbb{P}^1$. In fact, every regular function on $\mathbb{P}^1$ is constant. This is because $k[\frac{y}{x}] \cap k[\frac{x}{y}] = k$ with intersection taken in the function field $k(\frac{x}{y})$ on $\mathbb{P}^1$.
A: Yes, geometric properties of objects can be captured in the sheaves of functions on them.  For example, consider Castelnuovo's criterion, which gives a condition for
when a curve on a smooth algebraic surface to be "contracted" to a point, to produce
a new smooth surface.  The conditions are purely geometric,
but if you look at the proof given in Ch. V of Hartshorne's book, the method
involves a detailed consideration of the sheaf of functions, and sheaves of modules over it.
Some local properties are easy to encode in this way, e.g. as you note (non-)singularity
at a point can be detected by algebraic properties of the associated local ring.
But the encoding of more global properties (e.g. intersection theory) is more
subtle.  Cohomology typically plays an important role.
It's a little like topology: if you look at the definition of a topological space
for the first time, you might quite legitimately doubt that this could be an appropriate language for exploring a concrete problem such as whether a disk can be retracted
onto its boundary circle.  And indeed, it takes quite a lot of effort to build
up the tools necessary for proving such a statement using the language of topological spaces.  Similarly, it takes some effort in the foundations of algebraic
geometry to build up enough language and tools to express geometric properties
in the language of sheaves of rings and modules.   This is the goal of Hartshorne's text: the foundations of Ch. II and III serve to establish the necessary tools for
investigating the geometry of Ch. IV and V.
