The earliest use of the grid fins failed to land successfully because it ran out of hydraulic fluid. They use the RP1 from the main tank to run the hydraulics and they were initially open loop (the hydraulics). This meant they would use the fluid, and throw it away as they used it. Thus they ran out.
They later switched to a closed loop system so they do not run out of hydraulic fluid during landing.
We see the fins start against the side of the vehicle. They pop out during landing, and then after the vehicle lands, they safe themselves and retract back to the closed position.