Prior to the 17th Amendment, why did candidates running for office have debates in front of common people? If they couldn't elect them, then what was the use?
The use was to promote the candidates' respective parties. Lincoln and Douglas were campaigning before an election for the Illinois state legislature; shortly afterwards, the newly-elected legislature would vote for a Senator. The Democratic Party had promised that its legislative nominees would support Douglas for the Senate; the Republican party had promised its legislators would support Lincoln.
So, both Lincoln and Douglas were enthusiastically supporting their respective parties' legislative nominees, and everyone understood that their vote for state legislature would determine the Senator.