The peculiar velocity of the intergalactic gas responsible for the cosmic 21cm 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 21cm surveys is a promising tool for separating cosmology from 21cm 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 21cm signal in detail, improving upon past treatment and addressing several issues for the first time. (1) We show that properly accounting for finite optical depth eliminates the unphysical divergence of 21cm brightness temperature in overdense regions of the IGM found by previous work that employed the usual optically-thin approximation. (2) The approximation made previously to circumvent the diverging brightness temperature problem by capping velocity gradient can misestimate the power spectrum on all scales. (3) 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. (4) The linear theory for redshift-space distortion results in ~30% error in the observationally relevant wavenumber range, at the 50% ionized epoch. (5) We describe and test two numerical schemes to calculate the 21cm signal from reionization simulations to incorporate peculiar velocity effects in the optically-thin approximation accurately. 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 achieve sufficient accuracy. [Abridged]