Perseveration is the repetition of a particular response (such as a word, phrase, or gesture) despite the absence or cessation of a stimulus. It is usually caused by brain injury or other organic disorder. Symptoms include "lacking ability to transition or switch ideas appropriately with the social context, as evidenced by the repetition of words or gestures after they have ceased to be socially relevant or appropriate", or the "act or task of doing so", and are not better described as stereotypy (a highly repetitive idiosyncratic behaviour).
In a broader sense, it is used for a wide range of functionless behaviours that arise from a failure of the brain to either inhibit prepotent responses or to allow its usual progress to a different behavior, and includes impairment in set shifting and task switching in social and other contexts.
The primary definition of perseveration in biology and clinical psychiatry involves some form of response repetition or the inability to undertake set shifting (changing of goals, tasks or activities) as required, and is usually evidenced by behaviours such as words and gestures continuing to be repeated despite absence or cessation of a stimulus.
More broadly in clinical psychology, it describes mental or physical behaviours which are not excessive in terms of quantity but are apparently both functionless and involve a narrow range of behaviours, and are not better described as stereotypy (a highly repetitive idiosyncratic behaviour).
In general English, perseveration (vb: "to perseverate") refers to insistent or redundant repetition, not necessarily in a clinical context.
Perseveration of thought indicates an inability to switch ideas or responses. An example of perseveration is, during a conversation, if an issue has been fully explored and discussed to a point of resolution, it is not uncommon for something to trigger the reinvestigation of the matter. This can happen at any time during a conversation.