How is speed calculated and what effect does it have in combat?

Speed is a creature attribute. Base speed could be as low as 3 (Walking Dead from Necropolis) and as high as 21 (Phoenixes from Conflux). High speed is always a good thing to have.

During battles it determines both range of movement (how many hexes can this unit move) and the initiative (order of the creature turn among others). So creature with high speed will be one of the first to make their move and also can cover most of the battlefield.

On Adventure Map speed of the slowest unit in the army will affect Hero's movement points. So leave those Zombies at home.

There are artifacts that affect speed:

  • Cape of Velocity: gives +2 to Speed;
  • Necklace of Swiftness: +1;
  • Ring of the Wayfarer: +1.

There are spells that modify speed: Haste, Slow and Prayer. These spells could be automatically cast if you collect one of the following artifacts sets - Armor of the Damned casts Slow, Angelic Alliance casts Prayer and Ironfist of the Ogre (HotA only) casts Haste.

Creatures fighting on their native terrain will have +1 to Speed.

Additionally, having the fastest unit in your army will allow your hero to cast their spell first. And if this first spell will be Expert version of any speed modifying spell you can almost guarantee that majority of your units will act before enemy.

Source: Heroes Wiki - Speed