Ampere's law states that,
$$ \oint_C \vec{B} \cdot d\vec{l} = \mu_0 I_{enclosed},$$
where $I_{enclosed}$ is the total current enclosed or encircled by the loop $C$. In our case we will let the enclosed current simply be $I$ from the straight current carrying wire. For $C$ we will choose a circle with radius $r$ centered on the wire.
For the sake of precision I will also mention that the wire itself perpendicular to any radius of the circle.
This system has a variety of symmetries.
(1) Since the wire is infinite, straight, and carries uniform current the system remains unchanged if we translate it up or down (in a direction parallel to the wire itself). This means that the magnetic field is independent of where we are "vertically" in the picture.
(2) If we rotate our system about the wire, i.e., a rotation with the wire itsel as the axis of rotation then the system will remain unchanged. This means that the magnetic field, when it is rotated about the wire, must remain unchanged.
There are two independent ways that symmetry (2) can be satisfied by a vector field. Either (i) the vector field can circulate around the wire, or (ii) it can flow radially away from the wire. The second case would result in a net flux of the magnetic field away from the wire, which violates the flux rule for magnetic fields $ \oint_S \vec{B} \cdot \hat{n} dA = 0 $. We are left with case (i) with our magnetic field circulating around the wire, neither flowing toward it or away from it.
At any point on the circle $C$ the magnetic field will be tangent to the circle. Furthermore it will have the same magnitude at every point on the circle, if it did not then we would violate symmetry (2). This meas that $\vec{B} \cdot d\vec{l}$ can be written as $\|\vec{B}\| ds$ where $ds$ is the element of arclength along the circle.
We now have,
$$ \oint_C \vec{B}\cdot d\vec{l} = \oint_C \|\vec{B}\| ds, $$
now recall that $\|\vec{B}\|$ is constant on $C$,
$$ \oint_C \vec{B}\cdot d\vec{l} = \| \vec{B}\| \oint_C ds,$$
$$\boxed{\oint_C \vec{B}\cdot d\vec{l} = \| \vec{B} \| 2\pi r}$$
Now we write down amperes law,
$$ \oint_C \vec{B}\cdot d\vec{l} = \mu_0 I_{enclosed}$$
since the current in the wire is $I$ we substitute that for $I_{enclosed}$,
$$ \oint_C \vec{B}\cdot d\vec{l} = \mu_0 I$$
$$ \|\vec{B} \| 2\pi r = \mu_0 I$$
$$\boxed{ \|\vec{B} \| = \frac{\mu_0 I}{2\pi r}}$$