hypn0tik:
That is an intuitive definition, but it is misleading: there are an infinite number of field lines 'going through' any given surface S, given any vector field. I mean, a vector field in itself implies that there is some vector at every point in space (x1, x2, x3, ...). It really has a lot more to do with the magnitude of the vectors in question at the positions in question (i.e., all points on the surface in question). I mean, it's not the quantity through, it's the rate through.
All:
I mean, the easiest way to think of it, if you cannot get it intuitively, is to think in terms of dot products. Let's think in terms of infinitesimals, since that is more general. Suppose you have some "local" surface element dA, which is essentially a plane. To define that plane, we make some vector n s.t. n is unit and perpendicular to the plane. In that local area, there is also a vector, call it b. Then the "flux through dA" is simply b dot n. So it is a vector projection, in the direction of n; i.e., it captures the component of the b in the same direction as n, and returns that magnitude.
When you generalize to the nonlocal case, you just sum all of those b dot ns for all the little bs and all the little dAs. So, you get that flux of some field B through any surface A is integral over A of B dot dA. When the surface is a plane, the integral reduces to finding the area of the plane. When the vector field and surface normal vector are parallel, the dot product reduces to a scalar product.