In this question (Why was the Goblet of Fire portkey two-way?), it was said that the port key in GoF was probably layered and that the earlier bestowed spell was the one being activated later.
But how did Harry know that there was a second charm on the port key to bring him back?
Harry's experience with port keys was very limited at that moment, it was only the two port keys to and from the world cup (a shoe and a newspaper). So he didn't know that a port key could hold two destinations at the same time.