The e -> ie and o -> ue stem-changing verbs are the product of the interaction between two different factors
The first is the "breaking" of the Early Western Romance low-mid vowels /ɛ/ & /ɔ/ (which developed from the Latin short mid vowels /ĕ/ & /ŏ/) to /jɛ/ & /wɛ/ in stressed syllables followed by a merger of any remaining low-mid vowels (including the /ɛ/ in these new diphthongs) into the Early Western Romance high-mid vowels /e/ & /o/ (which developed from a merger of the Latin long mid vowels /ē/ & /ō/ with the short high vowels /ĭ/ & /ŭ/)
This was a regular sound change, and so affected the entirety of the lexicon across all parts of speech so can also be seen in nouns like (note that Romance nouns generally derive from the accusative):
- miel < mél vs meloso < melṓsum
- mes < mḗnsem
- fuego < fócum vs hogar < focā́rium (note that the on-glide in the diphthong also led to the preservation of the initial f)
- flor < flṓrem
The second is the position of the stress in Latin. Stress was on the penult if the syllable was "heavy" (containing a long vowel or a consonant coda), or else on the antepenult. This leads to a pattern where in the 1st, 2nd, & 4th conjugations the thematic vowel of the ending is stressed in the infinitive and 1st & 2nd person plural, but in all other forms the stem vowel is stressed
- 1st conjugation (these become -ar verbs in Spanish) e.g. amā́re:
- ámō ámās ámat amā́mus amā́tis ámant
- 2nd conjugation (these become -er verbs in Spanish) e.g. vidḗre:
- vídeō vídēs vídet vidḗmus vidḗtis vídent
- 3rd conjugation (these mostly become -er verbs in Spanish, but some, especially those in -iō become -ir verbs) e.g. dū́cere:
- dū́cō dū́cis dū́cit dū́cimus dū́citis dū́cunt
- 4th conjugation (these become -ir verb in Spanish) e.g. audī́re:
- áudiō áudīs áudit audī́mus audī́tis áudiunt
Put these two factors together, and we see that Latin verbs in the 1st, 2nd, or 4th conjugations with either an /ĕ/ or /ŏ/ as their stem vowel will break in all present tense forms except the 1st & 2nd person plural
- 1st conjugation:
- segar < secā́re
- siego siegas siegat segamos segáis siegan < sécō sécās sécat secā́mus secā́tis sécant
- volar < volā́re
- vuelo vuelas vuela volamos voláis vuelant < vólō vólās vólat volā́mus volā́tis vólant
- 2nd conjugation:
- tener < tenḗre
- tengo tienes tiene tenemos tenéis tienen < téneō ténēs ténet tenḗmus tenḗtis ténent
- doler < dolḗre
- duelo dueles duele dolemos doléis duelen < dóleō dólēs dólet dolḗmus dolḗtis dólent
- 4th conjugation:
- sentir < sentī́re
- siento sientes siente sentimos sentís sienten < séntiō séntīs séntit sentī́mus sentī́tis séntiunt
- morir < morī́re
- muero mueres muere morimos morís mueren < móriō mórīs mórit morī́mus morī́tis móriunt
The e -> i & o > u stem-changes are more complicated
At a stage before the breaking of stressed low-mid vowels, a following /j/ (which can develop from the loss of intervocalic voiced stops) caused the mid vowels to raise one step i.e. /ɛ/ -> /e/ -> /i/ & /ɔ/ -> /o/ -> /u/. As /ɛ/ & /ɔ/ merge into /e/ & /o/ in unstressed syllables the only affect this has on low-mid vowels is causing them not to break in stressed syllables
Instead, this effect is mostly noticed on the high-mid vowels where it results in an e -> i or o -> u shift. In many instances, especially with nouns and adjectives, this shift applies across the entire paradigm, and the /j/ may no longer be visible, but in -ir verbs it can occur in some forms, but not others
In many of these instances, the /j/ is usually still present, as in the 3rd person preterites, and the imperfect subjunctive. In some other instances, especially those that were originally 3rd conjugation verbs in -iō (or became such) the raised alternant caused by the /j/ in the 1st person singular and 3rd person plural was generalised across the present (except for the 1st & 2nd person plurals) by analogy to the e -> ie & o -> ue stem-change
Depending on its origin, and the specific sounds making up the stem of its Latin ancestor, a given verb might have no alternations, one set of alternations on its own, or both sets of alternations together. Over their history, many verbs have also changed conjugation, especially between 3rd & 4th conjugations, via the 3rd conjugation in -iō and, depending on when this occurred, this may or may not lead to unexpected raising stem-changes. Additionally, some verbs have lost their stem-changes over time due to analogy from the infinitive. In general as with most forms of analogy, this affects rarer verbs more than more common ones