Students with degrees in the STEM fields (Science, Technology, Engineering and Mathematics) will first apply for the regular 12 month period of OPT.
Then, once you have begun your first 12 months of OPT, if you meet the criteria as mentioned by the USCIS (see new immigration rules and regulations), you can apply for your 17 month OPT extension. You must file before your current OPT expires, however those students that have filed a timely application will be permitted to continue employment while extension application is pending until a final decision or 180 days, whichever comes first. The earliest you can file for the STEM extension is 120 days before your current OPT expires.
(source USCIS)



