Just as in biological evolution you end up with vestigial limbs, or organs that no longer serve any purpose, or body plans that seem wildly impractical (e.g. the recurrent laryngeal nerve, connecting the brain to the larynx but looping around the heart, or the fact the retina's blood supply is in front of it, not behind), so too do languages have irregularities. It's just the detritus that comes from having evolved naturally over time
There are three main sources of irregularities, and from a diachronic (i.e. looking at the entire history of the language), only one really looks properly irregular. The other two are just unusual. Of course, many words may have aspects of more than one of these going on
- Sound changes have unexpected side effects:
- As a language evolves its sounds do too. These changes can be either conditioned (where the outcome of a segment depends on the surrounding segments), or unconditioned. Sometimes these changes lead to alternations in a paradigm as different sound changes apply to different parts
- e.g. in the history of Spanish, Latin short e stays as e when unstressed (merging with Latin short i, and long ē), but becomes ie when stressed. Because Latin stress depends on the structure of the final two syllables (the rules used to be more complicated, but at the point this change applies, stress was fixed on the penultimate syllable), and verb endings have quite a varied number and shape, the stress moves around between the ending and the stem. This is the cause of stem-changing verbs e.g. contar "to count" - cuento "I count" - contamos "we count" < Latin computāre - computō - computāmus (via a regularly expected intermediate *còntarè - cònto - còntamos, with the grave accents representing the lower o & e descended from the short vowel)
- Retention of old paradigms:
- Sometimes stops using a certain morphological paradigm. Maybe it stops using the words that belong to it, or maybe words belonging to that paradigm get reanalysed as belonging to a different paradigm and adapted to fit it. Regardless, a few words are likely to be left behind inflecting in a way that now seems irregular
- e.g. Like German, Middle English retained a rudimentary case system, as well as a distinction between "strong" and "weak" nouns. Strong nouns form a genitive singular, and nominative/accusative plural with -es (this is the paradigm that came to dominate in Modern English, although we now distinguish between these two -es'es in writing), whilst weak nouns form all plurals and genitives with the the suffix -en. This survives in a few irregular plurals, notably ox - oxen
- Combined with type 1, this gives us things like English strong verbs (most verbs that people mean when they say "irregular" verbs in English). Proto-Germanic had already innovated a new way of forming a past tense, with a suffix in -d- (which gives Modern English -ed), but some verbs retain the earlier Proto-Indo-European system of ablaut. In this system, the vowel in the stem changes to form the past tense (and a slightly different set of endings are used). In Proto-Germanic, sound changes had already made the Proto-Indo-European ablaut patterns rather complicated (there are 7 classes of strong verb, some of which have subclasses), but they can still be traced moreorless directly back to a simpler PIE pattern. Unfortunately, by Modern English sound changes have made the patterns almost indiscernible and reanalysis has moved verbs between classes, made them regular or, in a few cases, even innovated new patterns of ablaut entirely
- English umlaut plurals (e.g. goose - geese) also come from a mix of type 1 & 2. In Proto-West-Germanic these were a form of neuter that formed its nominative plural by adding an -i ending. In a process called I-umlaut, this ending caused the preceding vowel to move forwards in the mouth and raise. This -i was later lost, but the umlaut remained. Despite this paradigm having generally fallen out of use (replaced with the usual -s plural), some words retain it
- Suppletion:
- This is the most truly irregular type, and is also the rarest. It's not just the sound of words that changes, but also their meaning. Through a process called semantic bleaching, an originally precise term can acquire a very broad and general one. This often leads to several words existing without a clearcut semantic distinction between them. Language abhors a true equivalents though so inevitably a pattern emerges with people using one form more often in some environments than the other. If the distinction is semantic or pragmatic, the meanings will just diverge, but often the distinction is morphosyntactic. Once this pattern has emerged and been noticed (even subconsciously) it becomes self-reinforcing as it becomes more and more marked to go against it. Eventually, this distinction becomes grammaticalised, with one synonym used in part of the paradigm, and another synonym used in another
- e.g. the verb "to be" has undergone this process twice. There are three sources of form in this verb, the b-forms (e.g. "be", "being", "been", used in non-finite, and imperative forms only), the w-forms (e.g. "was", "were", used in the past), and the s-forms (e.g. "am", "is", "are", used in the present). These all come from different PIE verbs. The s-forms go back all the way to the original PIE verb for "to be" and cognates can be found in most Indo-European languages. They are highly irregular, retaining many otherwise lost aspects of the PIE verb paradigm, and with odd sound change side effects. By Old English though, the w-forms had already merged into this forming a single verb "wesan" which used s-forms in the present indicative and subjunctive and w-forms elsewhere. At this point, the b-forms were still a separate verb "bēon" (the distinction was similar to, although not quite the same as, that between Spanish "ser" and "estar", with "bēon" being more like "ser") which later merged in during Middle English
- English has only a handful suppletive verbs (not counting verbs transparently derived from them) and possibly only a single suppletive noun: person - people (although in certain circumstances, plural persons, singular people, and plural peoples are all acceptable)
So irregularities get built up, but why not get rid of them? Why bother with all this nonsense instead of just saying "the persons' oxes be next to the gooses"?
Because it sounds weird
Making such a dramatic alteration to your speech requires conscious thought, and makes you stand out, and most people don't really want either when they're just going about their daily lives. And so if they're always hearing an irregular form be used, they're probably going to keep using it
Of course, if they don't hear the irregular form very often, they're less likely to remember the proper irregular form, and may default to a regular one. Over time, this form may even win out and the irregular form will have been regularised. This is why common verbs (especially "to be") are more likely to be irregular. It's not that frequent use makes them more likely to develop irregularities, just that it makes them more likely to retain those that they do develop