Understanding the equation for Potential Energy I am having a hard time understanding why Potential Energy can be calculated in the following way:
$$ \Delta U = U_f - U_i = -\int_{x_i}^{x_f} F_x dx $$
In particular, I don't understand why there is an integral in that equation. That is to say, why is it integrating the force in a system.
 A: Why an integral?
The integral comes from the work formula. When pushing something over a distance, you are applying work. Work is your force $\vec F$ times the displaced distance $\vec x$:
$$W=\vec F\cdot \vec x$$
If the force (or distance vector) changes along the way, then you have a problem and can't know which $\vec F$ (or $\vec x$) to insert into the formula. So you will have to calculate the work done before and after this change separately, because only here are the $\vec F$ and $\vec x$ constant.
$$W=\vec F_1\cdot \vec x_1+\vec F_2\cdot \vec x_2$$
For many, many changes, you must sum up smaller and smaller pieces of work done. We can invent the sum symbol $\sum$ for many terms summed - and the integral symbol $\int$ when they are essentially infinitely many (indicated by the infinitesimal symbol $d$):
$$
\begin{align}W=&\vec F_1\cdot \vec x_1+\vec F_2\cdot \vec x_2+\vec F_3\cdot \vec x_3+\vec F_4\cdot \vec x_4+\cdots\\
W=&\sum \vec F\cdot \vec x\\
\downarrow\\
W=&\int \vec F\cdot \vec dx\\
\end{align}$$
Why is this potential energy?
The work that a conservative force will do when released is called potential energy. That's all. So before it is released there must be
$$U=-W=-\int \vec F\cdot \vec dx$$
of energy stored. The negative sign indicates that the energy you provide as work to lift the book to the shelf corresponds to negative work done by the conservative force gravity.
A: Let us take for example the elastic potential energy:
$$U(x)=k\frac{x^2}{2}$$
The force is given by:
$$F(x)=-\frac{\partial}{\partial x}U(x)=-kx$$
As Señor O said in the comments, this is true only for conservative force fields.
If we want to get the potential from the force, we have to integrate the force:
$$U(x)=-\int F(x)dx=k\frac{x^2}{2}$$
$$\Delta U=-\int_{x_{1}}^{x_{2}} F(x)dx=k\left.\frac{x^{2}}{2}\right\rvert_{x_{1}}^{x_{2}}=U_{2}-U_{1}$$
A: NOTE: the "derivation" make in this answer is not rigorous, it is meant to show a way of looking at the formula in question.
Imagine a hill (in a geographical sense) who's altitude can be described by a function $f(x,y)$. We ignore the curvature of the earth, and consider the hill as standing on a plane in a Euclidean sense. Gravity will therefore by perpendicular to that plane, and we assume that it does not depend on altitude (the gravitational acceleration is constant $g$) 
Next, we place some object in some place that has the coordinates $(x_0, y_0)$ and there is no friction between the object and the field. The object will start to slide on the hill in the direction that has the  greatest slope. How fast will it change its position in this setup? We can say that given the information so far, the bigger the slope is, the faster the object will change its position.
OK, so far we have that the change in space of the object is proportional with the slope of the field. The slope of the field can be given by what we know as the gradient of the altitude function $\nabla f(x,y)$ so this part is covered. Now what is the rate of change in position, because it can be velocity, acceleration, jerk, etc. Can it be velocity? Not really, because if we consider that the slope of $f$ is constant, then the velocity would be constant and that is not what we see in nature. Can it be acceleration? Let's consider that the slope is $0$. In this case, if the object has some initial velocity, it will have the same velocity at any moment of time after $t_0$ so in some sense, if the slope is $0$, then  there is no acceleration. So we could say that the slope is proportional to the acceleration on the object. This means that $(a_x, a_y)=C\nabla f(x,y)$, where $C$ is a constant. 
Another thing. Consider a scenario where the slope is positive. If this is the case, the object will accelerate in the same direction with the slope, that is, it will accelerate up-hill. This is not the case in nature, so we add a minus sign and we are all set with the formula $(a_x, a_y)=-C\nabla f(x,y)$, where $C$ is a positive constant this time.
In order to get rid of $C$ we can include it in the slope and we get the differential form $(a_x, a_y)=-\nabla f(x,y)$
And now the last step. If we multiply our formula with the mass of the object, we get on the LHS the force $\vec F(x,y)$, and on the RHS the gradient of some function $U(x,y)$:
$$\vec F(x,y)=-\nabla U(x,y)$$
Now that you have some "intuitive derivation" for the differential form, and since the integral form you used is equivalent (as you mentioned in the comments), I think it should be clearer where the thing comes from.
From my point of view, even if you understand what I said here, you will have to know one of the functions in order to compute the other, and the way to do it is a different story. What you should get from this is how the force is linked to some function that describes the ability of an object to accelerate as a function of space and time.
