Step 1: Picture the solenoid as stacked loops:
A long solenoid is a series of closely packed circular loops. Inside, the fields of neighbouring turns add up along the axis. Between adjacent turns on the outside, the fields cancel. So for a very long coil $B_{outside} \approx 0$.
Step 2: Draw the Amperian rectangle:
Take rectangle PQRS with PQ of length $h$ placed inside the coil, parallel to the axis. RS lies outside the solenoid. QR and SP are perpendicular to the axis.
Step 3: Split the circulation into four parts:
\[ \oint \vec{B}\cdot d\vec{l} = \int_P^Q + \int_Q^R + \int_R^S + \int_S^P \]
Only $\int_P^Q$ is non-zero and equals $Bh$. The part along RS vanishes because the outside field is zero. The parts along QR and SP vanish because $\vec{B} \perp d\vec{l}$ inside and $\vec{B} = 0$ outside.
Step 4: Count the current through the rectangle:
The number of turns that pass through the rectangle is $n h$. Each turn carries $I$, so the net current linked is $nhI$.
Step 5: Equate:
\[ Bh = \mu_0 (nhI) \Rightarrow B = \mu_0 n I \]
The length $h$ cancels, which also shows that the field does not depend on where the loop is placed inside the coil, so the field is uniform.
Final Answer:
The magnetic field inside a long air-filled solenoid is:
\[ \boxed{B = \mu_0 n I} \]