Most major Canadian airports have a US border post in them, including Pearson. For direct flights from these airports to the US (Detroit) you'll pass through the US border pre-clearance after check-in and before getting to the departure gate in Toronto. You'll want to arrive a little bit early to the airport in Toronto to account for the time it'll take you to go through the US border before your flight departs.
(A notable Canadian airport without US pre-clearance is Billy Bishop Airport in downtown Toronto. Porter Airlines' US-bound passengers complete immigration on arrival like those from any other non pre-clearance airport in the world.)
In Detroit your flight will arrive alongside domestic US flights inside the departures security area. You can proceed directly to the gate of your connecting flight. You should have plenty of time.