The real question is how did Fredo manage to get out of Cuba and to New York? It had to be someone with Roth who helped him. And how did Tom with his New York connections know that Fredo was there (while he didnt know Pentangeli was alive?)
When Michael told Fredo, "I'll be driven back to my hotel, for my safety," I inferred from the first person pronoun that Fredo wasn't going to be in the car, and was not a target for assassination. The last we saw of Fredo, he was running in the streets with all the other escaping gringos. I assume that he ran for the embassy and got out that way like everyone else.
As for Tom: I'm guessing that, when the Senator told Michael that "you may very well be subject to perjury," both Tom and Michael realized simultaneously that "perjury" could only mean that Frankie had survived. So Tom called his contacts with the NYC detectives to confirm. Why he didn't do that before Michael perjured himself five times is probably one of the reasons why Michael was hurtful to him in the penultimate boathouse scene.