Under current law, all applicants for unemployment compensation must serve a waiting week. Since you cannot get benefits for the first week of unemployment that occurs after you file for benefits, you should apply as soon as possible after your job ends--even if you are not certain of your eligibility. Depending on how long you worked before losing your job, you can then collect benefits for up to 26 weeks (which may be further extended under certain circumstances under federal law).
Sometimes, but not always, an employer will contest a terminated employee's eligibility for unemployment compensation. Whether you receive unemployment compensation depends on a number of factors.