How can I average the variance extracted from different group of samples? I have groups of samples, where each group has a different number of samples and a different mean. I also know the variance of each group of samples. I would like to compute a sort of "average" variance, that should be something like the mean of my variances.
If the groups had all the same number of units, I think I could simply average the variances of each group summing up the variances and dividing by the number of groups.
However my groups have different sizes and I should, somehow, keep this into account.
How can I proceed?

The precise answer to your question depends on what are you going do to with it, but a possible answer could be to calculate the pooled variance. The poled variance is a method for estimating the variance of several different populations when the mean of each population may be different, but one may assume that the variance of each population is the same.
Suppose you have $k$ groups, the (corrected) sample variances $s_1^2, \ldots,s_k^2$ and the group size is $n_1,\ldots, n_k$. Then the pooled variance is
$$
s_{pool}^2 =\frac{(n_1-1)s_1^2+\cdots+(n_k-1)s_k^2}{(n_1-1)+\cdots+(n_k-1)}.
$$
Quoting from Wikipedia's page

If we can assume that the same phenomena are generating random error
at every level of $x$, the above data can be “pooled” to express a
single estimate of variance and standard deviation. In a sense, this
suggests finding a mean variance or standard deviation among the five
results above.

which, to me seems to answer what you are looking for.
