You will find various explanations for these. Here are mine.
1. Only the -ing form can be used after a preposition, so the preposition by is dropped when the infinitive is used, even though its meaning is still present.
The only way is [by / by means of / through] trying. The only way is [by / by means of / through] to try.