A Lagrangian density $\mathcal{L}$ is just an integrand, that is, an $n$-form. The corresponding action $\mathcal{S}$ is just the integral of the Lagrangian density, typically over the entire space. The goal is to choose the Lagrangian involving physical fields so that its extrema correspond to physically interesting conditions on those fields.
The simplest example is the action for a scalar field $\Phi$, which is given by \begin{equation} \mathcal{L} = d\Phi \wedge {*}d\Phi \end{equation} so that the corresponding action is \begin{equation} \mathcal{S} = \int_R d\Phi \wedge {*}d\Phi \end{equation} where $\Phi$ is a function, that is, a 0-form. We vary this action by considering a 1-parameter family $\Phi_\lambda$ of fields with \begin{equation} \Phi_0 = \Phi \end{equation} We then set \begin{equation} \delta\Phi = \frac{d\Phi_\lambda}{d\lambda} \Bigg|_{\lambda=0} \end{equation} so that \begin{equation} \Phi_\lambda \approx \Phi_0 + \lambda \,\delta\Phi \end{equation} to first order. This process is often written as \begin{equation} \Phi \longmapsto \Phi + \delta\Phi \end{equation} where $\delta\Phi$ is assumed to be small, so that higher-order terms in $\delta\Phi$ can be ignored.
We can now compute \begin{align} \frac{d\mathcal{S}}{d\lambda} \Bigg|_{\lambda=0} &= \int_R d(\delta\Phi) \wedge {*}d\Phi + d\Phi \wedge {*}d(\delta\Phi) \nonumber\\ &= \int_R 2\, d(\delta\Phi) \wedge {*}d\Phi \nonumber\\ &= 2 \int_R \bigl( d(\delta\Phi\,{*}d\Phi) - \delta\Phi\, d{*}d\Phi \bigr) \nonumber\\ &= 2 \int_{\partial R} \delta\Phi\,{*}d\Phi - 2\int_R \delta\Phi\, d{*}d\Phi \label{vary} \end{align} where we have used integration by parts and Stokes' Theorem in the last two steps. We now require that the integral ($\ref{vary}$) vanish for any variation $\delta\Phi$. By first choosing the support of the variation to be away from the boundary $\partial R$, we see that each integrand must vanish separately. Considering the second integral first, we must have \begin{equation} d{*}d\Phi = 0 \end{equation} on $R$, a statement which is often written as \begin{equation} \frac{\delta\mathcal{S}}{\delta\Phi} = -2\, d{*}d\Phi = 0 \end{equation} Thus, our original Lagrangian leads to the requirement that our scalar field satisfy Laplace's equation $\Delta\Phi=0$ — or, in the case of Minkowski space, the wave equation $\Delta\Phi = \ddot\Phi$.
One often assumes that the boundary term does not contribute, either by requiring that $\Phi=0$ there (such as by imposing suitable falloff conditions to infinity), or by specifying $\Phi$ at the boundary (so that $\delta\Phi=0$ there). In the absence of these assumptions, we can choose the variation $\delta\Phi$ to have (small) support on $\partial_R$, which forces the first integrand to vanish as well, so that \begin{equation} {*}d\Phi = 0 \label{ncond} \end{equation} on $\partial R$. But $\int {*}F$ is the flux of $F$ across the surface, so ($\ref{ncond}$) tells us that the derivative of $\Phi$ in the direction perpendicular to the boundary must vanish on the boundary.
A similar argument can be used to derive Maxwell's equations starting from the Lagrangian \begin{equation} \mathcal{L} = F\wedge{*}F = dA\wedge{*}dA \end{equation} where $F$ is the electromagnetic 2-form, and $A$ is the 4-potential.