  Measurements of two-particle correlation functions and the first five
azimuthal harmonics, $v_1$ to $v_5$, are presented, using 28 $\mathrm{nb}^{-1}$
of $p$+Pb collisions at a nucleon-nucleon center-of-mass energy of
$\sqrt{s_{\mathrm{NN}}}=5.02$ TeV measured with the ATLAS detector at the LHC.
Significant long-range ``ridge-like'' correlations are observed for pairs with
small relative azimuthal angle ($|\Delta\phi|<\pi/3$) and back-to-back pairs
($|\Delta\phi|>2\pi/3$) over the transverse momentum range $0.4<p_{\rm T}<12$
GeV and in different intervals of event activity. The event activity is defined
by either the number of reconstructed tracks or the total transverse energy on
the Pb-fragmentation side. The azimuthal structure of such long-range
correlations is Fourier decomposed to obtain the harmonics $v_n$ as a function
of $p_{\rm T}$ and event activity. The extracted $v_n$ values for $n=2$ to $5$
decrease with $n$. The $v_2$ and $v_3$ values are found to be positive in the
measured $p_{\rm T}$ range. The $v_1$ is also measured as a function of $p_{\rm
T}$ and is observed to change sign around $p_{\rm T}\approx 1.5-2.0$ GeV and
then increase to about 0.1 for $p_{\rm T}>4$ GeV. The $v_2(p_{\rm T})$,
$v_3(p_{\rm T})$ and $v_4(p_{\rm T})$ are compared to the $v_n$ coefficients in
Pb+Pb collisions at $\sqrt{s_{\mathrm{NN}}} =2.76$ TeV with similar event
multiplicities. Reasonable agreement is observed after accounting for the
difference in the average $p_{\rm T}$ of particles produced in the two
collision systems.
