I have an upcoming trip where I will be flying to and from Copenhagen, through Toronto. I notice that my departure and return gate in the Philadelphia airport is not in the international terminal.
Where will I clear customs?
Flights leaving the US to Canada do not have any special customs issues on the way out. You won't interact with customs or immigration as a general rule. Many people will look at your passport: the people before you go into security, the gate staff before they let you on the plane, etc, but they are just making sure you are likely to be accepted where you're going or that your name matches your ticket.
When you get to Toronto, you will probably need to clear Canadian customs (you tell them you're in transit) and then go to the international area, where there won't be any customs or immigration related to leaving Canada. For some flights, you can "stay airside" and not interact, or interact only very briefly, with Canadian customs and immigration.
When you get to Copenhagen, you will interact with Danish customs and immigration who will let you into the country.
On the way home, you will probably have to deal with the "leaving" customs and immigration, that's what I've experienced in general leaving Europe and I've left Copenhagen and recall walking FOREVER to the far end of the airport where they had the customs people for the outgoing fights. At least I think that was Copenhagen.
In Toronto you may again have a brief interaction with Canadian customs and immigration, and then you will meet US customs and immigration for the pre-clear. To enable more US airports to be served from Canada, you get admitted to the US while you're still in the Canadian airport. At that point your plane can now land in the domestic part of the US airport (which for many small airports is the entire airport) and when you land you can just head out of the airport, you're all set.