Who polices the police in the USA? Is there anyone a police officer has to answer to for committing racist acts, abusing their power, or committing other crimes unnecessarily?
In theory, there are multiple layers of oversight. Individual police officers are supposed to be held accountable, most directly, by their supervisors and departments. As in other countries, US police departments have internal affairs divisions to investigate and respond to all forms of law-breaking and misconduct by police officers. Beyond that, abusive police can face civil lawsuits and criminal charges (although in practice they are somewhat rarely convicted). If there are patterns of abuse which are not being sufficiently handled internally, then the various levels of government also have authority to intervene.
The Wikipedia article on "Police reform in the United States" gives a timeline of significant events and changes over time. In the 1970s and 1980s, special commissions (like the Knapp Commission in New York City) and civilian review boards at the local level became increasingly common. A federal law, The Violent Crime Control and Law Enforcement Act of 1994 gave the Department of Justice's Civil Rights Division authority to bring civil suits against local and state police departments.
As this has been an important political issue for decades, a lot more can be said. For just one example of the many books on this topic see The New World of Police Accountability by Samuel E. Walker and Carol A. Archbold.
The internal affairs refers to a division of a law enforcement agency that investigates incidents and possible suspicions of law-breaking and professional misconduct attributed to officers on the force. It is thus a mechanism of limited self-governance, "a police force policing itself". In different systems, internal affairs can go by other names such as internal investigations division (usually referred to as IID), professional standards, inspectorate general, Office of Professional Responsibility, internal review board, or similar.
The internal affairs function is not an enforcement function, but rather a policing function that works to report only. The concept of internal affairs is very broad and unique to each police department. However, the sole purpose to having an internal affairs unit is to investigate and find the truth to what occurred when an officer is accused of misconduct. An investigation can also give insight on a policy itself that may have issues.
Civilian review board
Several police departments in the USA have been compelled to institute citizen review or investigation of police misconduct complaints in response to community perception that internal affairs investigations are biased in favor of police officers
Suggested reading: The History of Policing in the US, PDF, 16 pages.
It was not until the 1830s that the idea of a centralized municipal police department first emerged in the United States. In 1838, the city of Boston established the first American police force, followed by New York City in 1845, Albany, NY and Chicago in 1851, New Orleans and Cincinnati in 1853, Philadelphia in 1855, and Newark, NJ and Baltimore in 1857 (Harring 1983, Lundman 1980; Lynch 1984). By the 1880s all major U.S. cities had municipal police forces in place.
These “modern police” organizations shared similar characteristics: (1) they were publicly supported and bureaucratic in form; (2) police officers were fulltime employees, not community volunteers or case-by-case fee retainers; (3) departments had permanent and fixed rules and procedures, and employment as a police officers was continuous; (4) police departments were accountable to a central governmental authority (Lundman 1980).
In the Southern states the development of American policing followed a different path. The genesis of the modern police organization in the South is the “Slave Patrol” (Platt 1982). The first formal slave patrol was created in the Carolina colonies in 1704 (Reichel 1992). Slave patrols had three primary functions: (1) to chase down, apprehend, and return to their owners, runaway slaves; (2) to provide a form of organized terror to deter slave revolts; and, (3) to maintain a form of discipline for slave-workers who were subject to summary justice, outside of the law, if they violated any plantation rules. Following the Civil War, these vigilante-style organizations evolved in modern Southern police departments primarily as a means of controlling freed slaves who were now laborers working in an agricultural caste system, and enforcing “Jim Crow” segregation laws, designed to deny freed slaves equal rights and access to the political system.
In addition to what Brian mentioned in his good answer, for cases where someone violates civil rights while acting "under color of law" (which includes, but is not limited to law enforcement officers,) the federal Department of Justice can intervene and bring criminal charges under 18 USC 242
18 U.S. Code § 242.Deprivation of rights under color of law
Whoever, under color of any law, statute, ordinance, regulation, or custom, willfully subjects any person in any State, Territory, Commonwealth, Possession, or District to the deprivation of any rights, privileges, or immunities secured or protected by the Constitution or laws of the United States, or to different punishments, pains, or penalties, on account of such person being an alien, or by reason of his color, or race, than are prescribed for the punishment of citizens, shall be fined under this title or imprisoned not more than one year, or both; and if bodily injury results from the acts committed in violation of this section or if such acts include the use, attempted use, or threatened use of a dangerous weapon, explosives, or fire, shall be fined under this title or imprisoned not more than ten years, or both; and if death results from the acts committed in violation of this section or if such acts include kidnapping or an attempt to kidnap, aggravated sexual abuse, or an attempt to commit aggravated sexual abuse, or an attempt to kill, shall be fined under this title, or imprisoned for any term of years or for life, or both, or may be sentenced to death.
The text is a bit of a pain to parse, but the "on account of such person being an alien, or by reason of his color, or race" part only modifies "or to different punishments, pains, or penalties... than are prescribed for the punishment of citizens." This limitation does not apply to the main part about "willfully subject[ing] any person... to the deprivation of any rights, privileges, or immunities secured or protected by the Constitution or laws of the United States." As the Department of Justice itself notes,
It is not necessary that the crime be motivated by animus toward the race, color, religion, sex, handicap, familial status or national origin of the victim.
So, any action by law enforcement that willfully deprives any person "of any rights, privileges, or immunities secured or protected by the Constitution or laws of the United States" may be prosecuted as a federal crime, regardless of what the local department's Internal Affairs office decides. It is additionally important to note here that, while the Constitutional prohibition on double jeopardy normally prohibits being tried for the same offense twice, the Dual-Sovereignty Doctrine holds that the state and federal governments may each try someone for a particular offense if it violates both state and federal laws and the Supreme Court has reaffirmed this doctrine within the past year.
As such, even if a police officer were charged and then let off for a particular offense which violated civil rights by their state government, the federal government could still bring charges against them. Unfortunately, though, it seems that this power granted to DoJ is not wielded nearly as often as it probably should be with respect to actions of corrupt or brutal law enforcement officers.