In the sentence "Racing thoughts refers to the rapid thought patterns that often occur in manic, hypomanic, or mixed episodes," the term racing thoughts is being used to refer not to certain actual thoughts that happen to move swiftly, but to the character string racing thoughts. The Chicago Manual of Style refers to this type of usage as "a word being used as a word"—and the normal way to indicate such usage is to put it in italics or boldface or quotation marks.
And in fact, that is how the Wikipedia page you link to handles the term racing thoughts in the opening sentence of the entry:
Racing thoughts refers to the rapid thought patterns that often occur in manic, hypomanic, or mixed episodes.
Because racing thoughts here refers to a phrase to be defined, and not to the plural thoughts themselves—it properly takes a singular verb.
In each of the next two sentences, however, the subject is the actual racing thoughts, not the term racing thoughts, so the plural form of the verb (and no use of italics) is appropriate:
While racing thoughts are most commonly described in people with bipolar disorder and sleep apnea, they are also common with anxiety disorders, OCD, and other psychiatric disorders such as attention deficit hyperactivity disorder. Racing thoughts are also associated with sleep deprivation hyperthyroidism, and the use of amphetamines.
In making the distinction, it might be helpful to think of what's going on this way: if you can add the words "the term" before the phrase in question and make the verb singular, and it still sounds okay, the phrase is being used in reference to the written term, as if it were a dictionary entry. But if adding the words "the term" in front of the phrase in question and making the verb singular causes the sentence to sound weird or obviously wrong, the phrase is being used to refer to the real-world phenomenon behind the name.
Taking this approach in the Wikipedia example, we get this wording:
The term racing thoughts refers to the rapid thought patterns that often occur in manic, hypomanic, or mixed episodes. While the term racing thoughts is most commonly described in people with bipolar disorder and sleep apnea, it is also common with anxiety disorders, OCD, and other psychiatric disorders such as attention deficit hyperactivity disorder. The term racing thoughts is also associated with sleep deprivation hyperthyroidism, and the use of amphetamines.
The first sentence still sounds perfectly normal, but now the second and third sentences don't make sense, and that's because, unlike the first sentence, the second and third sentences are not using racing thoughts in the "term used as term" way.