A quick explanation of how an 'accident' like that can happen (not a justification and not comprehensive of all scenarios, just from my perspective):
Strikes on civilian gatherings are more likely when the only intelligence used to make the decision are IMINT and SIGINT.
SIGINT would typically be radio activity of interest. This could be: - Known hostile entity using the radio (example: Taliban member known to US intelligence) - unidentified entities using a known enemy radio frequency (some non-state actors used particular channels for certain communications) - unknown entities communications indicated hostile association/intent. (example: members of ISIS-K discussed direct involvement in the bombing of a children's hospital)
So an analyst has determined SIGINT of interest. The signal is then geo-located to an accurate enough place in the AOR to warrant additional collection, typically a drone feed.
A reaper or predator is sent it get a direct visual of where the signal was geo-located.
Back in the day, the feeds weren't super high definition. Thus, a wedding or funeral just looks like a bunch of potentially military aged males gathering in one place.
Some things that could cement a strike authorization is seeing somebody a the wedding with a hand held radio, or collecting more SIGINT in the immediate facility. Someone attending the wedding/funeral is talking on the radio again, maybe the person previously identified as associated with the hostile group.
Depending on the conflict, that's more than was needed to authorize a strike and how we wind up reading about these gatherings getting drone striked.
Incomplete intelligence and lax rules of engagement
It's also worth mentioning that in many of the countries where these kinds of 'accidents' happen, firearms can be culturally significant as a rites of passage for males in a community. So a wedding/funeral may also appear as being partially composed of military aged armed males.