Some people with tics will repeat something which someone has just said. This is called echolalia. A person with echolalia is not intentionally mimicking someone, they are never trying to be rude. Echolalia can sometimes pick up on accents and may repeat what someone has said in an exaggerated accent.
There is also such thing as delayed echolalia, where someone isn't repeating what has just been said but is repeating something they heard in the past, such as something memorable someone said to them or something in a video that the tics picked up on.
Echolalia can also involve repeating sounds which one has just heard. For example, if someone hears beeping they may immediately tic 'beep beep beep', or if an alarm goes off a person may start making the same noise as the alarm straight after it has started going off.
People can have a mental tic known as echoskepsi where they repeat what they have just heard in their mind. Repeating one's own thoughts is called paliskepsi. People may also repeat things in their mind that they have heard in the past as part of echoskepsi.
Some people may copy another person's movements. This is known as echopraxia.
Conditions which cause echolalia / echophenomena:
As well as being a tic in people with tic conditions such as Tourette Syndrome and conditions such as PANDAS/PANS, echolalia is also associated with Autism and Schizophrenia.