first, sorry for my poor English and I hope you can understand what I'm asking. It seems a subject of an infinitive phrase usually appears to be the same as that of a sentence.
"I went to get help and by the time I got back he had stopped breathing." from lexico
"Sadly, she didn't live to see her grandchildren" from cambridge dictionary
but there are other cases like
when a subject of a sentence is an object of an infinitive phrase and a subject of it doesn't appear in the sentence:
"The plant is relatively easy to identify." from oxford learner's dictionary
"The sauce takes 25 minutes to prepare and cook." from collins dictionary
when a subject of a sentence is not a subject or an object of an infinitive phrase:
"The show may sound like one for the tourists, but passports are not required to get a ticket at the Olympia box office." from lexico
"A lot of patience is required to look after a disabled child." from longman dictionary
" It's too hot to go for a bike ride." from longman dictionary
when an object of a sentence is a subject of an infinitive phrase:
"The same lawyers told him to bring charges to a civil court and the sports court of arbitrage." from lexico
"Do you want me to take you to the airport?" from cambridge dictionary
So what makes it happen? Am I right to understand that context decides a subject and an object of an infinitive phrase when it is omitted? or is there any grammar rule about this?