The Sanskrit root man- ("think") is related to the English word "mind" and to "mental" (from Latin mens/ment-). In particular, a Sanskrit mantra is the thought behind a ritual action that is expressed in the form of a sound. Mantras are powerful, so you will sometimes see the word translated as "prayer" or as "spell" (in the sense of a magic spell).
Because mantras are often repeated, the word has come to be used in English to refer to anything that is repeated over and over again, like a formula or a slogan.
The most famous mantra is the one expressed through the sound OM, which is shown in written form below. You can find out more in the Wikipedia article about Mantra and also in the article about OM: