By default, running a cell in a Sage worksheet causes the input to be run as Sage commands, with output from Sage written to the output of the cell. Mode commands in a Sage worksheet cause the input to be run through some other process to create cell output. For example,
Typing %md at the start of a cell causes cell input to be rendered as markdown in the cell output.
Typing %r causes cell input to be treated as statements in the R language, with corresponding output.
Typing %HTML causes cell input to be treated as HTML, rendered as the output.
There are many built-in modes (e.g. Cython, GAP, Pari, R, Python, Markdown, HTML, etc…)
Note: If it is not the default mode of your *.sagews worksheet, a mode command must be the first line of a cell. In other words, make sure the command %md, %r, or %HTML is the first line of a cell.
Alternatively, you can make any mode the default for all cells in the worksheet using %default_mode <some_mode>. Then all cells will be using that chosen mode. If you choose this approach, you may still explicitly use %sage for cells you want processed by the Sage interpreter (or %foo to explicitly switch to any non-default mode).