Energy bands, surface states, and resonant transmission of electrons in finite one-dimensional crystals