A Russia-led military contingent completed its withdrawal from Kazakhstan as the country lifted a state of emergency after unprecedented unrest.