The trapezoid rule approximates
$$\int_c^d f(x) dx = \frac{d-c}{2}(f(c) + f(d)).$$
Set $n \geq 1$ and take $x_i = a + ih$, for $i = 0, 1, \ldots, n$,
with $h = (b-a)/n$. The composite trapezoid rule
specifies
$$\int_a^b f(x) dx \color{var(--emphColor)}{\approx} {h \over 2}\bigg(f(a) + 2\sum_{i=0}^{n-1} f(x_i) + f(b)\bigg)$$
The value $f(x_i)$ appears twice in the sum for each interior point
$x_\color{var(--emphColor)}{1}, \ldots, x_\color{var(--emphColor)}{n-1}$,
since each of these nodes is both the start and the end of some subinterval.