There are several kinds of chi-square tests but the most common is the Pearson
chi-square test which allows us to test the independence of two categorical variables.
Suppose we have a hypothesis that the pass/fail rate in a particular mathematics class is different for male and female students. Say we take a random sample of 100 students and measure both gender (male/female) and class status (pass/fail) as categorical variables.
The data for these 100 students can be displayed in a contingency table, also known as a cross-classification table. A chi-square test can be used to test the null hypothesis (i.e., that the pass/fail rate is not different for male and female students).
Just as in a t-test, or F-test, there is a particular formula for calculating the chi-square test statistic. This statistic is then compared to a chi-square distribution with known degrees of freedom in order to arrive at the p-value.
We use the p-value to decide whether or not we can reject the null hypothesis. If the p-value is less than "alpha" which is typically set at .05, then we can say that our data provide strong evidence that the null hypothesis is false (i.e. reject the null hypothesis), thus providing some evidence that the alternative hypothesis is true (i.e. the likelihood of passing the class is different for males and females).