This condition essentially needs to be imposed 'on faith', to some degree, because we intuitively feel that physical sources should be localized, and for those we can work out that the fields decay fast enough that the surface term vanishes.
This is not to say that we're just wishing away terms that we find inconvenient: instead, we explicitly make the caveat that what follows is valid for localized sources only ─ and we make the slightly circular definition that a 'localized source' (or a localized field) is one for which the relevant surface terms vanish.
In the majority of cases, it is very hard to come up with a (useful) necessary condition on the fields and sources which is equivalent to the vanishing of that surface term. We know plenty of sufficient conditions (of the form 'for such-and-such class of localized sources, the surface term vanishes'), and those are broad enough to cover most cases of interest, but it's hard to make more general statements.
In a sense, this is more of a "credit" view of mathematical rigour, as opposed to the "debit" view that mathematicians tend to hold: where they say "OK, my fields satisfy X and Y niceness hypotheses, let's work out what results I can prove from those", physicists tend to tell rigour "well, I want that term to go away, so you can just bill me later by telling me what conditions my fields need to satisfy for my formalism to hold".
And indeed, this kind of assumption can indeed come back and bite us. One famous example is the separation of optical angular momentum into orbital and spin contributions, as described here, via an integration by parts of the form
$$
\mathbf J
=
\frac{1}{\mu_0c^2} \int\mathrm d\mathbf r \: \mathbf r \times (\mathbf E\times\mathbf B)
= \frac{1}{\mu_0c^2} \int\mathrm d\mathbf r \: (E_i (\mathbf r \times\nabla) A_i )
+ \frac{1}{\mu_0c^2} \int\mathrm d\mathbf r \: \mathbf E\times \mathbf A
=\mathbf L + \mathbf S,
$$
where you get this weird paradox: if you plug in a circularly-polarized plane wave, then $\mathbf L$ is zero but $\mathbf S$ is not, but the initial $\mathbf J$ also seems to vanish, so something is off: the problem here is that the boundary terms (or the regions where the beam tapers off) carry nonzero angular momentum, and cannot be neglected. This apparent paradox has puzzled many an unsuspecting author.
Nevertheless, we still use the equation (as we do with the one you mentioned) because it holds for what we think are physical fields, and we're prepared to say "it's zero because I say so" and accept that if it's not zero then the fields are probably not physical and we shouldn't be using them as such.