How were Senators and Presidential electors chosen by bi-cameral legislaures?

Before the 17th Amendment members of the Senate were chosen by the state legislatures, and in the early days of the republic the legislatures of some states also elected members of the electorial college. Since most state legislatures are bi-cameral, how exactly did that work? Did each house vote separately? If so, how did they resolve it if they came to a different result? Did they meet and vote in a joint session? If so did each member have one vote? Or were the individual votes weighted to preserve a balance between both houses? Or, was one Senator in a given state chosen by the state Senate, and the other by the state House? Were there different procedures in different states?

They set their own rules and it didn’t work too well in many cases.

With respect to Senators, the majority of states always had the legislature meet in joint session and cast a joint ballot until one candidate got a majority.

For example, in Illinois, after the Lincoln-Douglas debates, the 75 Illinois state representatives and 25 state Senators met in joint session, and the result was 54 votes for Douglas and 46 for Lincoln, so Douglas was elected.

Massachusetts was one of the few (and for a while, I believe, the only) states in which the houses voted separately, and you needed a majority of each house to win. The famous anti-slavery Senator Charles Sumner was first elected as part of a convoluted compromise necessary to secure a majority of each house.

In 1866 Congress took advantage of its power under the “times, places, and manner” clause to establish uniform rules that the states had to follow, and required joint balloting, so Massachusetts had to change.

With respect to electors, I don’t know. Most states switched to popular vote early on and I’ve never seen documentation as to the nuances of the early elections.