What is a potential function? I want to understand this intuitively!

My textbook keeps on using the word potential, and I keep on thinking about potential energy U = m*g*h, but this is a MATH textbook. What is this thing called 'potential'? Intuitively, what is a potential function? What should I immediately think of?

You'll have to be more specific with the context to get a full answer, because the first thing I think of would indeed be gravity (though more so the V(r) = GMm/r potential, not V = mgh). Mathematically speaking, forces like gravity or the electrical attraction between charged particles are called "conservative forces", which basically means they have associated "potential functions". A conservative force is one for which the work required to move an object from point A to point B depends only on the straight-line distance between the two points. It doesn't depend on the path you choose to get from A to B.

Now, what underlies this mathematically is the concept of vector fields. The force of gravity and the electrostatic attraction between charged particles are examples of vector fields. A conservative vector field is one with an associated potential function (the vector field is the gradient of the potential function). If you perform a line integral between two points of a conservative vector field, the value of the integral depends only on the value of the potential function at the two points, not on the path between them, just like the Work done by a conservative force.

So, unless you have a different context for "potential function", gravitational potential is really just an example of a potential function and the gravitational force is really just an example of a vector field.

The curl operator acts on vector fields. The potential is a scalar field, so the curl operator cannot act on it. The curl can, however, operator on the gradient of a potential field - but it turns out the curl of the gradient of a scalar field is always zero! So, another way of identifying a conservative vector field is to check its curl: if the curl is always zero, it's conservative*.

(*There are of course always caveats, one being that if the domain your vector field is defined on has a hole in it, for example, the theorem doesn't apply)