It usually depends on you.  The fastest way to get your child back is to do what they ask of you.  Goals of most CPS is permanancy which means they want the most permanent place and usually with family.  If you do whatever they ask you (drug tests, treatment, classes) you should get the child back.  Do whatever you have to do to prove yourself to them.  If it has been a while and they still have custody somewhere else and have closed the case, you can petition the court on your own.  Just be ready to show the judge you changed.  If you have not done anything to try before now and it has been a while, it could be too late.  Just remember it is your child.  DO WHAT YOU HAVE TO.