Set the brake, as it should be, then get off.
+1 ^^^^ This.
Also, be sure to switch off the blades/PTO too. Most riding equipment engines will shut down (or won't start) if:
- No operator in seat AND parking brake is off OR brake pedal not held down.
- No operator in seat AND blade/PTO is on.
- No operator in seat AND shift lever is not in neutral.
Most of this safety stuff is to prevent an operator from getting too close to spinning mower blades, or, to keep the equipment from moving unless there is an operator in the seat. Most originated with ANSI safety standards, which are often used for Federal Consumer Product Safety regulations, and thus are applied to all modern riding equipment sold in the USA.