What does ' (single quote) do in the terminal?

A terminal does not only accept one-line code. Actually, you can write code (as bash scripting is a programming language) in multiple lines.

For example, if you write:

while true; do <enter>

it will show exactly the same > that showed to your case, as well. It lets you input more commands. Now, if you type in:

echo "Cake is a lie" <enter>
sleep 1              <enter>
done                 <enter>

it will start running your code (which, in this occasion it is simply a while loop that will output a string every 1 second). This allows you to build up small programs without having to write them in one-line code, like this:

while true; do echo "Cake is a lie"; sleep 1; done

which, in this case it isn't such a problem, but it could be, in other occasions (with more code to be written).

So, it is generally used for writing multiple lines of code. In your occasion, the shell recognizes that you don't have an even number of ' inside your code, and this could not work in any case (the same applies for "). So, it let's you write more code in order to complete what you've left.

For example, if you give as command:

echo "Cake is a <enter>

then it will let you continue. And indeed, you can:

lie"            <enter>

It will normally output:

Cake is a
lie