A state's lieutenant governor or whoever is the second in command usually takes over if the governor dies before his 4-year term is over. In addition, the lieutenant governor also takes over if the governor resigns, is removed from office or is otherwise disabled from completing his duties.
Although most states have lieutenant governors to take over, Wyoming, New Hampshire, Arizona, Oregon and Maine do not have this position as of 2015. These states, however, do have secondary officers designated in their constitutions.
Depending on the state, the lieutenant governor may be elected separately from the governor or they may be elected together. The governor doesn't always get to select who holds this role.