The peculiar velocity of the intergalactic gas responsible for the cosmic 21-cm background from the epoch of reionization and beyond introduces an anisotropy in the three-dimensional power spectrum of brightness temperature fluctuations. Measurement of this anisotropy by future 21-cm surveys is a promising tool for separating cosmology from 21-cm astrophysics. However, previous attempts to model the signal have often neglected peculiar velocity or only approximated it crudely. This paper re-examines the effects of peculiar velocity on the 21-cm signal in detail, improving upon past treatment and addressing several issues for the first time. (1) We show that even the angle-averaged power spectrum, P(k), is affected significantly by the peculiar velocity. (2) We re-derive the brightness temperature dependence on atomic hydrogen density, spin temperature, peculiar velocity and its gradient and redshift to clarify the roles of thermal versus velocity broadening and finite optical depth. (3) We show that properly accounting for finite optical depth eliminates the unphysical divergence of the 21-cm brightness temperature in overdense regions of the intergalactic medium found by previous work that employed the usual optically thin approximation. (4) We find that the approximation made previously to circumvent the diverging brightness temperature problem by capping the velocity gradient can misestimate the power spectrum on all scales. (5) We further show that the observed power spectrum in redshift space remains finite even in the optically thin approximation if one properly accounts for the redshift-space distortion. However, results that take full account of finite optical depth show that this approximation is only accurate in the limit of high spin temperature. (6) We also show that the linear theory for redshift-space distortion widely employed to predict the 21-cm power spectrum results in a ∼30 per cent error in the observationally relevant wavenumber range k∼ 0.1–1 h Mpc−1, when strong ionization fluctuations exist (e.g. at the 50 per cent ionized epoch). We derive an alternative, quasi-linear formulation which improves upon the accuracy of the linear theory. (7) We describe and test two numerical schemes to calculate the 21-cm signal from reionization simulations to incorporate peculiar velocity effects in the optically thin approximation accurately, by real- to redshift-space re-mapping of the H i density. One is particle based, the other grid based, and while the former is most accurate, we demonstrate that the latter is computationally more efficient and can be optimized so as to achieve sufficient accuracy.