In a nutshell
Rabin-Karp speeds up the search by comparing numbers instead of strings. It turns the pattern, and each equally-long window of the text, into a number called a hash. Equal strings always share a hash, so any window whose hash differs from the pattern's is skipped instantly without comparing a single character. Only when the hashes match does it verify character by character, since different strings can occasionally collide on the same hash. A rolling hash recomputes each new window's number from the previous one in one step, which keeps the average cost linear.