(While this is my first answer here, I have been active on physics.stackexchange for multiple years, specifically in the subject of classical mechanics.)

The action is purely a mathematical instrument.

In the image below the curves represent the case of an object being thrown upwards against a potential that gives a 2 $m/s^2$ acceleration: it rises and descends again. With 2 $m/s^2$ acceleration and duration of 2 seconds the true trajectory reaches a height of 1 meter.

Black curve: trajectory of the object

red curve: kinetic energy

green curve: minus potential energy

When you sweep out a range of trial trajectories the curves of the energies change accordingly.

The image displays the point in variation space where the trial trajectory hits the true trajectory: then the red curve (kinetic energy) and the green curve (*minus* potential energy) are parallel to each other. (They're parallel of course since the rate at which the kinetic energy is changing must *match* the rate at which the potential energy is changing.)

So: what you need is a method to know where the slopes of the red/green curves are not equal, and where they are.

To that end we use the following property of the value of an integral: when start point and end point of a curve are fixed then when the *slope* of that curve changes the value of that curve's integral changes in proportion.

In the image below the curves on the left are the same as the curves of the first image. The curves on the right are the corresponding functionals.

In the example presented here (2 $m/s^2$ acceleration) the potential increases linear with height. The green line on the right shows how the integral of the minus potential energy responds to variation of the trial trajectory. Here the green functional is a straight line because here the potential energy increases *linear* with height. The red functional represents how the integral of the kinetic energy responds to variation of the trial trajectory. Since the kinetic energy is a quadratic function of the velocity the red functional is a *quadratic function* of the variational parameter.

There is only one point where the respective values of the two integrals change *at the same rate* (changing in opposite direction). That point is the point where the trial trajectory hits the true trajectory.

About generality:

The way the integral of the potential energy responds to variation of the trajectory will in general be different from the way the integral of the kinetic energy responds to variation. This is independent of the way the variation is implemented.

Emphasizing a key point:

The purpose of the integration is to obtain information about the *slope* of the potential/kinetic energy curve of the trial trajectory. Slope information is usually obtained with differentation, but in this case with integration.

This particular example is the simplest case: a potential that increases linear with height. The reasoning generalizes to all cases.

General discussion:

The concept of Hamilton's stationary action has both physics content and mathematical content.

The physics content consists of the Work-Energy theorem.

The rest is mathematical instrument.

[Later edit]

Below is an animated GIF, showing how the curves representing the energies respond to variation of the trial trajectory. The slider changes the variational parameter.

(The images illustrating this answer are my own work, they're screenshots of diagrams from my own website. )

mechanical activityof the system at time $t$. A ball sitting on top of a hill is intuitively less active that the same ball rolling down the hill, so it makes sense that kinetic energy contributes positively and potential energy contributes negatively to the activity. $\endgroup$1more comment