Echolalia: the word "echo" derives from a Greek word that means "to repeat" and "lalia" meaning "speech/talk". It is also a form of stimming. This phenomena is an automatic repetition of words, phrases, and sounds that were heard. This may happen right after hearing something or may be delayed by days, weeks, months, or even years. It is a normal part of speech development but it lasts much longer in autistic children. Some do not outgrow this trait. It is also more complex for autistics than it is for allistics. Although it indicates a lack of social understanding, it is in fact a form of communication. Don't make the mistake however, to take it at face value.
From an outside perspective, witnessing an autistic person appearing to be talking to themselves might make them look like they belong in a psych ward. It may make us appear crazy, but I assure you that we're not. Not to say that I have anything against those who are legitimately mentally ill, but this is why some people may confuse an autistic person for a schizophrenic. Echolalia in the official sense of the word means to mirror speech, but the truth is that there are subtypes. Before I delve into this, I do want to make a point that some autistic people are more self-aware than others. Some may do this in public unconsciously, while I only do this unconsciously in private.
Subtype 1: Repetition
This is the exact repetition of speech. This is not a good thing if you're a parent who swears like a sailor.
Subtype 2: Conversational
This is when I repeat a conversation I had earlier on or invent one entirely to practice socializing. What appears like fluid natural speech is in fact the result of years of conversational echolalia practice inside my head, or out loud in private. Just because my social skills didn't come naturally to me doesn't mean that I'm not genuine. I'm an open book, I'm just difficult to read. I've learned to adjust my approach in a way that is receptive to neurotypicals. I've learned a lot through trial and error. Experience is the best teacher that has taught me lots of bitter lessons. I'll never forget the time in grade 7 when a girl walked into the locker room and caught me talking alone. The news spread like wildfire that I talked to myself. Good times.
Subtype 3: Imaginary
It's not a secret that life is way more interesting inside my head. To survive our dull and mundane reality, I create scenarios. I know these scenarios are fictitious, but they keep me entertained. Sometimes they make me laugh (hence my nickname giggles!) and help me tolerate the real world.
Subtype 4: Poetic
I'd think that math geniuses must also do this with numbers (Subtype 5: Numerical?). It probably overlaps with OCD. Growing up, I was constantly dissecting words inside my head in the midst of someone talking to me or to a group. I would dissect words by their syllables, vowels, and consonants. I would also repeat letters that sounded pleasant; I had an affinity for consonants ending with the sound "ee" like Bs, Cs, Ds, Gs, etc. This evolved to mentally rhyming words in real time. Mental freestyle, if you will. This was often at the expense of not registering what was being said. This leads me to a funny story that happened in grade 4. We were learning about Ancient Egypt. The teacher started listing off names of Egyptian gods: Osiris, Isis, Anubis... All of the names she had listed at that point rhymed, so I started rhyming words along in my head. I guess I got ahead of myself and accidentally blurted out 'penis!'. Luckily, somehow nobody actually heard me say it. I was mortified nonetheless.
In a nutshell, this "strange" autistic trait is actually a learning tool. This is what has helped me develop my conversational skills. Again, I never did this in front of people. I do it unconsciously all the time when I'm alone. When I'm "talking to myself", I assure you I'm not beside myself. It teaches me to get ahead, and sometimes I get ahead of myself.