Here are some random thoughts. As to where we get the idea from, I think it was partly the consequence of acknowledging a couple of things. First, that there is one Church, one body of Christ (Eph. 4:4). And second, that there are saints alive in heaven (Rev. 5:8; 6:9-11; 7:9-15), or as Hebrews puts it when speaking of the Old Testament saints: "we also are compassed about with so great a cloud of witnesses" (Heb. 12:1). So, speaking of a Church triumphant is gives full expression, and takes literally, the Scriptural passage which says that "God is not the God of the dead, but of the living." (Matt. 22:32)
As far as how prayer plays into it, I think that this idea is partly why the Orthodox affirm that saints in the afterlife can indeed pray for us. The saints are not disconnected from the body of Christ, but aware of what is going on, even participating with us in the spiritual life. I've been told that this is one reason that we cense the entire Church, even if there is no one on a side where the priest is censing--because whether we see anyone or not, the Church triumphant is there, participating with us. Thus also one of the reasons that we fill our Church with icons, to remind us that we are indeed surrounded by the Church triumphant.
Regarding the resurrection, I'm not sure what to say about that. Of course there is the particular judgment immediately upon death, after which people get a foretaste of what they will experience for all eternity. The resurrection doesn't happen until the end of time, when "the dead, small and great, stand before God; and the books were opened: and another book was opened, which is the book of life: and the dead were judged out of those things which were written in the books, according to their works." (Rev. 20:12) Until that time, the saints in the Church triumphant can understand the prayerful communications to them from the Church militant, and can also communicate prayers to God. After the general resurrection, I suppose there will be no more Church militant, but only a Church triumphant, and on the other hand those who experience the "second death," who are "cast into the lake of fire." (Rev. 20:14-15).