The speed stat mainly, but also items, moves abilities can hinder or help speed.
Abilities: A few abilities enhance speed while conditions are right. For example Swift Swim/
Items: A few items can hinder or help speed also, such as quick claw, and a negative effect would be Lagging tail.
Priority moves: Quite a few moves have priority, such as quick attack, Sucker Punch, Mach Punch, And when combined with speed and an item, you will almost always go first.
But moves can also hinder speed. Such as Counter, Mirror Coat. Which have a negative priority/