After the end of the United States Civil War in 1865, the country was united again and slavery was made illegal in all states. Unfortunately, while blacks were legally free men on paper, common prejudice and discrimination continued as whites -- especially Southerners, who were angry about losing the war and their bid for sovereignty -- placed blacks into a lower social class. To this end, the Jim Crow laws were invented to keep blacks from aspiring to a higher social position, or considering themselves equal with whites. The landmark legal case of Plessy v. Ferguson (1896) cemented the acceptability of "separate but equal" in many people's minds.
The most common example was segregation, which kept blacks from mingling with whites in most public places, including restaurants, churches, offices, bathrooms, and places of business. Segregation continued in one form or another until the 1950s. Examples of "whites-only" or "blacks-only" signs can still be seen in historic, refurbished, or abandoned buildings. Blacks were also prohibited from voting, which meant that they could not support candidates sympathetic to civil rights.
The main focus of the Jim Crow was to prevent blacks from mingling with whites, especially in marriage or politics. This stemmed both from the scientific beliefs of the time -- which were slowly proven wrong -- and from standard prejudice. Most whites shared these beliefs, and had no reason to doubt them aside from moral or ethical concerns. Because blacks were almost never involved with politics, there was no push to overturn the laws until after World War II, when the Civil Rights Movement began to gain real momentum.