To place a flag, press Shift key and then the square. To undo placing a flag, do the same.