For more complicated models the degrees of freedom get more complicated, but follow similar ideas. The numerator degrees of freedom are based on the number of groups that you are comparing (for 1-way it is the number of groups minus 1) and the denominator degrees of freedom are based on the number of observations within the groups (for 1-way it is the number of observations minus the number of groups). The F distribution has 2 types of degrees of freedom. If you would rather use a rejection region than a p-value, then you can use the F table or the qf function in R (or other software). Looking up this ratio on the F-table (or computing it with a function like pf in R) will give the p-value. If the null is false, then the numerator will be large relative to the denominator and the ratio will be greater than 1.
So when the null of all means equal is true then the 2 measures (with some extra terms for degrees of freedom) will be similar and the ratio will be close to 1. The denominator is an average of the sample variances for each group, which is an estimate of the overall population variance (assuming all groups have equal variances). But if the null hypothesis is false and the means are not all equal, then this measure of variance will be larger. The numerator is computed by measuring the variance of the means and if the true means of the groups are identical then this is a function of the overall variance of the data. If the null hypothesis is true then these are both estimates of the same thing and the ratio will be around 1. The F statistic is a ratio of 2 different measure of variance for the data.