The question is to prove this using geometry: For $p$ and $q$ coprime, $$\left\lfloor\frac{p}{q}\right\rfloor +\left\lfloor\frac{2p}{q}\right\rfloor+\cdots + \left\lfloor\frac{(q-1)p}{q}\right\rfloor = \frac12(p-1)(q-1)$$
I could think of nothing else but the fact that $\frac12(p-1)(q-1)$ is the number of points inside the triangle I drew (basically a rectangle with dimension $p,q$ and the triangle is formed by diagonal).
Can anyone give any small hints so that I proceed further or how can we relate the number of integral points inside the triangle with the diagonal? Would drawing lines further of which make the slope of $2p/q$ etc help?
I think you have already found the answer, or are very close to it.
You have the observation that there are $(p-1)(q-1)$ lattice points inside a rectangle of width $p$ and height $q$ with corners at the lattice points $(0,0)$ and $(p,q).$ The diagonal of that rectangle between those two points has the equation $y = \frac pq x.$
The fact that $p$ and $q$ are coprime is important because it means that the diagonal does not pass through any other integer lattice points between $(0,0)$ and $(p,q).$ So the diagonal does not just separate the lattice points inside the rectangle into three groups (one below the diagonal, an equal number above, and some points on the diagonal); it separates them into just two disjoint subsets with the same number of points in each.
Now you just need to identify the points below the diagonal with the terms $\left\lfloor \frac pq\right\rfloor,$ $\left\lfloor \frac {2p}q\right\rfloor,$ $\left\lfloor \frac {3p}q\right\rfloor,$ and so forth.
As a step toward that, notice that the diagonal passes through the points $\left(1,\frac pq\right),$ $\left(2,\frac{2p}q\right),$ $\left(3,\frac{3p}q\right),$ $\left(4,\frac{4p}q\right),$ and so forth. Again, because $p$ and $q$ are coprime, none of those points is a lattice point. Try counting the number of lattice points below each of those points and above the bottom edge of the rectangle.