+0

Are these all correct? If not, the how can I tell it's one and not the other pattern?

1. There are different ways:

a) to do this.

b) of doing this.

2. It gives you the opportunity:

a) to meet different people.

b) of meeting different people.

+1
EyeSeeYouAre these all correct?

Yes.

EyeSeeYouhow can I tell it's one and not the other pattern?

You can go by frequency of use.

ways of doing is used more than ways to do.
opportunity to do is used more than opportunity of doing.

Of these, opportunity of doing is used least.

Personally, and by chance, I use the more frequent forms in my own speech and writing, even though, as I said earlier, all four are correct.

(You can look up the frequency counts in the Google Ngram Viewer if you're interested.)

CJ