The p-value is calculated based on the null hypothesis, which states that there is no effect or no difference. Researchers perform statistical tests, such as the t-test or chi-square test, to compare observed data with what would be expected under the null hypothesis. The resulting p-value indicates the likelihood of observing the data if the null hypothesis were true.