The function of the infinitive phrase in the sentence <em>To win a marathon is my goal </em>is object of the verb.
It is definitely an object, and it would follow a verb if it were a normal ordering of words in the sentence (My goal is to win a marathon), and since it is not preceded by a preposition, it cannot be object of the preposition, but of a verb.
Good morning
Tell me if this is mean sorry but it is evening
Why was he studying?
When was he studying?
How was he studying?
With who was he studying?
Where was he studying?