We can apply Ampere's law to find the magnetic field generated by a loop of wire: taking any closed loop, the line integral of the magnetic field on this loop is equal to the product between the permeability [tex]\mu[/tex] times the current flowing through this loop.
In our example, let's take a rectangular path with one side of length L parallel to to the axis of the wire loop. The contribution on the two other perpendicular sides is zero, as well as for the side outside the wire loop, so the only relevant contribution of the magnetic field is BL. So we have
[tex]BL = \mu I N[/tex]
where I is the current flowing through the wire loop, and N the number of loops in the length L. So we can write the magnetic field inside the wire loop as
[tex]B=\mu \frac{N}{L} I=\mu n I[/tex]
where [tex]n= \frac{N}{L} [/tex] is the number of loops per unit of length.
Using the right hand rule, one can see that the field inside the wire loop has the same direction of the axis of the wire loop, while the contribution outside the wire loop is negligible.