We review the theory of vortices in trapped dilute Bose-Einstein condensates and compare theoretical predictions with existing experiments. Mean-field theory based on the time-dependent Gross-Pitaevskii equation describes the main features of the vortex states, and its predictions agree well with available experimental results. We discuss various properties of a single vortex, including its structure, energy, dynamics, normal modes and stability, as well as vortex arrays. When the nonuniform condensate contains a vortex, the excitation spectrum includes unstable ("anomalous") mode(s) with negative frequency. Trap rotation shifts the normal-mode frequencies and can stabilize the vortex. We consider the effect of thermal quasiparticles on vortex normal modes as well as possible mechanisms for vortex dissipation. Vortex states in mixtures and spinor condensates are also discussed.