Can DNA tests determine ethnic background? How?

Can DNA tests determine ethnic background? How?

No. A DNA test cannot determine ethnic background. Ethnicity is mostly defined by society and cultural traits.
Sometimes an ethnic group can have similar genes due to being isolated from other ethnic groups.
Ethnicity is based on common origins and traditions and DNA has nothing to do with it. Any genetic distinction of a certain ethnic group can only take form after the community is created.
Cultures cannot be identified solely by their genetic codes, but some ethnicities require a certain ancestry while others require to have been raised in a specific culture or traditions.