This has been asked and answered in the past in various forms. The most direct response probably would be this one from /u/Reedstilt :
That's not to say nobody else is welcome to answer it here, or more in-depth with better sourcing, as the answer I linked to is 5 years old and I believe sourcing wasn't as strict and rigid back in AH's earlier days, but it is still correct and factual.
I can answer the Wisconsin half. First a bit about the northern borders of Illinois, Ohio, and Indiana, as that plays into this. The Northwest Ordinance of 1787 was passed by Congress and established what was known as the Northwest Territory. This territory included land which was the area west of Pennsylvania, west and north of the Ohio River, east of the Mississippi river, and south of the international border with Canada. The Ordinance provided that three to five states would be created from this land. If more than three states were created, the Ordinance specified that the northern boundary was an east-west line drawn from the southern tip of Lake Michigan. I've hijacked google maps to give a rough sketch of this Ordinance Line in orange.
Ohio was the first state created from the Northwest Territory. At the time of Ohio's creation, maps indicated that Lake Michigan's southern tip was north of the 42nd parallel. Ohio accepted the Ordinance Line, but then began to receive information from traders that Lake Michigan extended much further south than originally thought. This was a problem, as Ohio desired the Maumee Bay (Toledo) as a harbor. Depending how far down Lake Michigan stretched, this could lead to a future state north of Ohio claiming the bay. Ohio put a proviso in their state constitution that if Lake Michigan's southern tip was far enough south that the Ordinance Line put the Maumee Bay out of Ohio, that the line should instead be drawn from the southern tip of Lake Michigan to a point to the north of the Maumee Bay. However, Congress did not explicitly accept this boundary proviso and in fact later defined the Michigan Territory's southern border as the Ordinance Line.
When Indiana entered the union in 1816, Congress allowed Indiana to extend its northern border to a point 10 miles north of this line in order to access Lake Michigan. At that time, Michigan did not have a territorial delegate in Congress and could not object.
Illinois also wanted access to Lake Michigan. Territorial delegate Nathaniel Pope moved the northern border of Illinois north to its present location on the theory that if Illinois did not have access to the waterways of the great lakes, that they would use the southern rivers. This would lead to greater relationships between Illinois and southern states, which might cause Illinois to side with those southern states in any disputes at the federal level. Congress accepted this modified northern boundary.
At this point, all three states formed from the southern land of the Northwest Territory had borders north of the Ordinance Line. As maps became better, Michigan realized that the southern tip of Lake Michigan would push the Ordinance Line into Ohio far enough to put the Maumee Bay in Michigan Territory. Congress set out to survey the Ordinance Line in 1817, commissioning William Harris to survey the ordinance line with specific instructions to adhere to the border specified in Ohio's enabling act (the Ordinance Line) and not the line Ohio put in their own state constitution. Harris ignored this and surveyed a line from the southern tip of Lake Michigan to a point north of Maumee Bay. The Ohio state government accepted this line, but the Michigan Territory did not. Michigan disputed the border it claimed (Ordinance Line) with that claimed by Ohio (the Harris Line). Michigan could not logically press its claim on the southern border with Ohio being the Ordinance Line without also disputing its southern border with Indiana (10 miles north of the Ordinance Line), and by extension disputing the northern border of Illinois.
As a territory rather than a state, Michigan Territory only had one representative in Congress as a territorial delegate. Indiana, Illinois, and Ohio combined had 29 representatives and six senators. This created difficulties for Michigan in pressing its claim in Congress. At the time, Michigan Territory desired to enter the Union as a state with the Upper Peninsula land east of the Straits of Mackinac only. Congress eventually offered Michigan a compromise: accept 9,000 square miles of additional land in the Upper Peninsula, but also accept the Harris line as the border with Ohio and accept the existing border with Indiana. Another factor: the federal government was due to have a budget surplus in 1836. The surplus was to be returned to the states on the basis of population. If Michigan was a state, it would be due approximately $400,000. If it was a territory, it would get nothing. Though unhappy with the extra land in the Upper Peninsula (the mineral wealth of the area was unknown), this added incentive convinced voters in Michigan, and Michigan accepted the borders as proposed by Congress.
The western border of Michigan's Upper Peninsula was demarcated by Congress as being the Montreal and Menominee rivers, which were thought at the time to be contiguous with a headwaters at Lake of the Desert. Captain Thomas Jefferson Cram set out to survey this line in 1840 and found that the waterways were not contiguous. Congress refined the new boundary between Wisconsin and Michigan to be the middle of the Menominee River to the Brule River, along the southern shore of Lake Brule, then a direct line to Lake of the Desert, then a direct line to the headwaters of the Montreal River and from there to Lake Superior.