For all ages:
1) You need a police certificate from any place where you were arrested no matter your age or length of stay.
For people over 16:
2) You need a police certificate from you current locality if you have lived there for over 6 months.
3) You need a police certificate from other parts of your country if you lived there for over 6 months after your 16th birthday
4) You need a police certificate for any other country you lived in for more than 12 months after your 16th birthday
You do NOT get police certificate for US residency. In other words, if you previously or currently are living in the US you will not apply for a police certificate for the US.
Determine when to apply
For many countries, police certificates can take 2-3 month to obtain. This is especially true when you are applying for a certificate for a country in which you are not currently living. For instance, if you live in England, but taught English in Japan for 2 years, it could take 10 weeks to get the police certificate from the Japanese consulate. Make sure you give yourself enough time to apply for the certificates before your visa interview (or before submitting the documents to the NVC for immigrant visas). But, remember that the certificates expire so you should not apply for a certificate the same day that you file your initial petition. Chances are that it will expire before your visa application is even approved.
Apply for your clearances.
Check http://travel.state.gov/visa/frvi/reciprocity/reciprocity_3272.html. This link gives you the ability to search for directions on applying for the police certificate from each country you need. You select the country and then scroll down to the section for police clearances. This section should tell you how and where to apply for the police clearance. For instance, applicants from the Phillipines will find that they should apply for their NBI certificate. This certificate can be issued at police stations in most major cities for 150.00 pesos.