Chi-Square test is for checking the association between two things. It's the sum of the square of the difference between the observed count and the expected count.
If there is no association between two things, the observed value is normally close to the expected value and thus the sum of the differences is small.
Chi-Square = Sum[(Observed - Expected)^2/Expected]
For example, we want to study the association between gender and having a job. The numbers of males/females (not) having a job are as follows:
As there are 80 males and 65 males in the study, the percentage of males is 80/(80+65) = 55%. There are 90 jobs in total so males are expected to have 90 * 55% = 49.5 jobs. And the no job number is expected to be 55 * 55% = 30.2. The percentage of females is 65/(80+65) = 45%. Females are expected to have 90 * 45% = 40.5 jobs, and have 55 * 45% = 24.8 no jobs.
Therefore
the Chi-Square = (50 - 49.5)^2/49.5 + (30 - 30.2)^2/30.2 + (40 - 40.5)^2/40.5 + (25 - 24.8)^2/24.8
The Chi-Square gives a value, and then you can check the probability of having that value in the Chi-Square table which is derived from the Chi-Square distribution.
The probabliy is the confidence the two things are associated.