Can I get German citizenship if my ancestors left Germany before 1871?
tl;dr No
Germany did not exist before 1871. You would first you have to find out from which country your ancestors came and what the laws of that country said about the loss of citizenship for citizens who emigrate. Bavarians for example would lose Bavarian citizenship according to article 7 of the 1812 law on Bavarian citizenship if they emigrate, settle abroad with the intention of not coming back, naturalize abroad as a citizen of another country, marry a foreigner as a woman, travel outside of Bavaria for more than one year without approval, serve in a foreign military without approval, get a salary or pension from a foreign government, accept a foreign jurisdiction, or die. https://books.google.de/books?id=AKNEAAAAcAAJ&pg=PA209#v=onepage&q&f=false
If your ancestors somehow kept the citizenship of their country until 1871 then they got German citizenship when Germany was founded in 1871. This brings us to the next problem: Continue here.