Second variation techniques for stability in geometric inequalities