Ampère’s law considers the electric current, I, enclosed by a magnetic field, B, that forms a closed loop. In post 25.16, we saw how to calculate the magnetic field surrounding an electrical current using the Biot-Savart law. Now we are going to consider the current enclosed by a magnetic field line. We will represent an elemental arc in the loop by the vector δL.
According to Ampère’s law there is electrical current, I, enclosed within this magnetic loop given by the definite integral

where the P at the foot of the integral sign denotes integration around the whole loop and μ0 is the permeability of free space. I am following convention here by considering that the conductor carrying the current is surrounded by a vacuum (but it doesn’t make much difference if it is surrounded by air – see post 16.25).
I’m not going to give a rigorous derivation of equation 1; In post 25.16, I used a simple form of the Biot-Savart law to calculate the magnetic field due to the current in an infinite straight wire. In the appendix, I use this result to derive equation 1 is from this simple form of the Biot-Savart law.
In the remainder of this post, I give an example to show that Ampère’s law and the Biot-Savart law give consistent results.

The picture above shows a magnetic field, whose modulus is a constant, B, by a blue dotted line. Although the modulus of B is constant, its direction changes because it lies in a circular path of radius r. Here δL lies in the same direction as B, so that the dot product B.δL = B δL. Now we can replace equation 1 by

Noting that B is constant this becomes

Evaluating this integral around the circular loop gives

Equation 5 in post 25.16 results from calculating the magnetic field surrounding the current in a wire. Comparison with this calculation shows that the results are consistent.
Related posts
25.16 Biot-Savart law
25.10 Magnetic fields
16.25 Electrical charge
Appendix
A special case of the derivation of equation 1 from the Biot-Savart law

In post 25.16, I showed that the magnetic field surrounding an infinite straight wire, conducting an electrical current I, is a circle of radius r, perpendicular to the wire with the wire as its centre. Then B was given by

Here the unit vectors i and j lie in the directions of the current and the radius, respectively. This is summarised in the picture above that is taken from post 25.16 where you can find more details. Note that B, the modulus of B, has a constant value of

around the circle.
Now let the vector δL represent an infinitesimal arc of the circular magnetic field line. Since δL lies in the direction of B

And, noting that B is constant,

Evaluating the integral on the right-hand side around the circular path and substituting the value of B given above produces the result

which is Ampère’s law.