Here's a very heuristic argument for how one might come up with such an action. First of all, by looking at the typical Maxwell's equations in terms of $E$ and $B$, we see that the PDEs are linear in the electric and magnetic fields. As such, if we want to encapsulate the information of $E$ and $B$ into the field strength 2-form $F$, then the equations involving $F$ also better be linear.
As such, if we want to start from an action, we need $F$ to appear in there "quadratically", because once we perform the variation, we would then arrive at equations linear in $F$. Now, since the spacetime manifold $M$ is 4-dimensional, we need to be integrating a 4-form... this is just basic integration on manifolds.
So, how can we construct a $4$-form using $F$ which is also "quadratic"? Well, the most natural choices are:
- $F\wedge F$
- $F\wedge \star F$
- $(\star F)\wedge (\star F)= F\wedge (\star \star F)=F\wedge F$ (because in general
$\alpha \wedge \star \beta = \beta \wedge \star \alpha$)
Now, $F\wedge F= dA\wedge dA = d(A\wedge dA)$, which means by Stokes' theorem, this term shouldn't affect the equations of motion. Therefore, the first and the third options are out, thereby leaving us only with the second one. Of course, from here, we can put in factors of $\pm\frac{1}{2}$, and then add on coupling terms like $A\wedge J$, where $J$ is the current 3-form etc to get the action
\begin{align}
S[A,dA]&=\int_M \frac{1}{2}(dA)\wedge (\star dA) \pm A\wedge J.
\end{align}
Performing the variation then yields the
field equation $d(\star dA)= \mp J$ (and the trivially true equation $d(dA)=0$). Written in terms of $F$, this reads:
\begin{align}
\begin{cases}
d(\star F)&= \mp J\\
dF&= 0.
\end{cases}
\end{align}
(I'm not sure about the sign because $\star\star$ may be $\pm 1$ depending on the degree of the form and right now I can't remember which way it should be).
This is as best as I can motivate the situation (though I'd love to hear other opinions); because all we've done here is start out with some general principles (in this case linearity of the field equations, and of course the obvious thing that we should be integrating a 4-form on a 4-manifold), then proposed some possible actions based on these principles, and then narrowed down to a particular choice then verify that our choice does indeed give the right field equations. After all, there is no "cookie-cutter" procedure for obtaining actions.
Side comment: you use the terminology "volume form", yet there is no volume form here. A volume-form is a top-degree differential form which is nowhere vanishing. In our situation $F$ may very well vanish at some points. What you probably meant is simply a top-degree differential form.