Spike did get his soul back in season 6 of Buffy. Basically Spike wants to become good because he falls in love with Buffy. He doesn't really understand love without a soul though. At one point he basically ends up raping Buffy. He has remorse for that and goes off on a journey to discover how to restore his soul. He finds a demon shaman, and Spike undergoes a series of brutal trials. He passes the trials and the shaman restores his soul.