Did Einstein really say the “definition of insanity” quote?
There is no good evidence that he did. The saying appears in print decades after Einstein’s death and was attached to his name later.

What you need to know
The line “insanity is doing the same thing over and over and expecting different results” is widely credited to Albert Einstein, but researchers have not found it in his writings, speeches, letters or interviews. Einstein died in 1955. Closely related versions appear in recovery literature around 1981, and the familiar wording appeared in Rita Mae Brown’s 1983 novel “Sudden Death.” Reference works on Einstein list the attribution as unsupported. So the clean answer is: useful saying if you like it, but not a verified Einstein quote.
1955
Recovery literature around 1981
Appears later and is unsupported by a primary source