I just started learning Simple linear regression model in midway and I found that
$y=\beta_0+\beta_1x+\epsilon$
$V(\beta_0)=\sigma^2(\dfrac{1}{n}-\dfrac{\bar x^2}{S_{xx}})$
Where $S_{xx}=\sum_{i}^{n}(x_i-\bar x)^2$
$V(\beta_1)=\dfrac{\sigma^2}{S_{xx}}$
So $\sigma^2$ is unknown and we replace it by its estimator so before going further I thought it would be $S^2=\frac{\sum_{i}^{n}(x_i-\bar x)^2}{n-1}$ but its not . I am not able to figure out where my thought process is wrong.
Note that $\sigma^2$ is the variance of the error term $\epsilon$, hence you need, like for the random variable $X$, realizations of $\epsilon$, that are $\{e_i\}_{i=1}^n$. Given the regression models, $e_i = \hat{y}_i - y_i $, the sample variance is $$ \frac{\sum ( \hat{y}_i - \bar{y} ) ^2}{ n } = \frac{\sum e_i ^2}{ n }, $$ you can divide by $n-2$ if you want the unbiased estimator of $\sigma^2$.