why does the slope of a vertical tangent equal $ \infty $ or $ - \infty $? we know that for any point on a curve, the slope of its tangent is m:
$$ m = \lim_{h \to 0} \frac{f(x+h)-f(x)}{h} $$
But i can’t understand that for a point which has a vertical tangent, why does the slope  of its tangent be $ \infty $ or  $  - \infty $?
They both are this case: as the denominator $h$ becomes close to $0,$ the numerator $f(x+h)-f(x)$ also becomes close to $0.$
But why does m for the point which has a non-vertical tangent equals a number, but for the point which has a non-vertical tangent equals  $ \infty $ or  $  - \infty $ ?
 A: $y-b=m(x-a)$ is the general equation of a line in 2D. When the slope  $m=\pm \infty,$ we can write
$x-a=(y-b)/m \implies x=a$, a vertical line.
A: To answer your question, we first have to understand the definition of the gradient of a line.
The gradient is simply defined as the change in $y$ over the change in $x$ i.e. $m = \frac {\Delta y} {\Delta x}$. It can also be defined as the 'steepness' of a line. The formula for the gradient of a slope is often referred to as 'rise over run', where the 'rise' refers to the change in $y$ and the 'run' refers to the change in $x$.
With a vertical line, the change in $x$ is $0$. When this is the case, the gradient of the tangent line is undefined (since we cannot divide by 0). The gradient of the tangent line is instead $-\infty$ or $+\infty$ (depending on which side you approach it from), which tells us the tangent line is indeed vertical.
It might be helpful to look at an example.

Given the curve $y = x^{1/5}$, find the gradient of the tangent line at $x = 0$.

Using the following formula, the gradient of the tangent can be found:
$$m = \lim_{\Delta x \to 0} \frac{f(c + \Delta x) - f(c)} {\Delta x}$$
Thus, the gradient is as follows:
$$m = \lim_{\Delta x \to 0} \frac{(0 + \Delta x)^{1/5} - (0)^{1/5}} {\Delta x}$$
$$m = \lim_{\Delta x \to 0} \frac{(\Delta x)^{1/5}} {\Delta x}$$
$$m = \lim_{\Delta x \to 0} \frac{1} {\Delta x^{4/5}} = +\infty $$
As you can see above, as $\Delta x$ approaches $0$, $\frac{1} {\Delta x^{4/5}} \ $ approaches $+\infty$.
We can further expand this by approaching the point from a certain side, as follows:
$$m = \lim_{\Delta x \to 0^-} \frac{1} {\Delta x^{4/5}} = +\infty$$
In the above scenario, we are approaching the point from the left side i.e. using values that are negative. Raising a negative value to an even power results in a positive value. Thus, the limit approaches $+\infty$.
The same concept can be applied when approaching the point from the right side i.e. using values that are positive.
$$m = \lim_{\Delta x \to 0^+} \frac{1} {\Delta x^{4/5}} = +\infty$$
In the above scenario, raising a positive value to an even power results in a positive value. Thus, the limit approaches $+\infty$ as well.
It might be helpful to watch this video on vertical tangent lines (the source of this example).
I hope that helps!
