Nicola Sturgeon, the nationalist firebrand who dominated Scottish politics for almost a decade, has bowed out with an emotional valedictory speech.