Use it when expressing the idea of continually practicing to retain skill in a less intense way. She retired but keeps her hand in teaching by giving occasional lectures.
Pro Tip 2/3
Not Full-time
Implies involvement is sporadic or part-time, not a full-time commitment to the activity. After selling his bakery, Joe still keeps his hand in by baking at home.
Pro Tip 3/3
Idiomatic Usage
Recognize that it's a figure of speech, so the 'hand' is not always literal. I keep my hand in web design by doing small projects.