The procedure of recovery from penalty strongly depends on the type of penalty. Basicly you can be penalized by building artificial backlinks or by having thin content on your website. In the first case you should remove bad backlinks, in the second case you should improve your website (rewrite thin articles, increase user engagement etc.).