To answer this question, let's first identify all the different functions of the gift of tongues according to Paul:
Tongues can be used to edify oneself:
4 The one who speaks in a tongue builds up himself, but the one who prophesies builds up the church. [1 Cor 14:4, ESV]
Tongues can be used to edify others (provided that there is interpretation, in which case they are equivalent to a prophecy):
5 Now I want you all to speak in tongues, but even more to prophesy. The one who prophesies is greater than the one who speaks in tongues, unless someone interprets, so that the church may be built up. [1 Cor 14:5, ESV]
Tongues can be used in prayer and worship:
13 Therefore, one who speaks in a tongue should pray that he may interpret. 14 For if I pray in a tongue, my spirit prays but my mind is unfruitful. 15 What am I to do? I will pray with my spirit, but I will pray with my mind also; I will sing praise with my spirit, but I will sing with my mind also. [1 Cor 14:13-15, ESV]
The specific use in worship is confirmed by Acts 2:11 (we hear them telling in our own tongues the mighty works of God) and Acts 10:46 (For they were hearing them speaking in tongues and extolling God), and since these praises in a tongue are directed at God, they can be viewed as instances of prayer as well.
Tongues as a sign for unbelievers:
21 In the Law it is written, “By people of strange tongues and by the lips of foreigners will I speak to this people, and even then they will not listen to me, says the Lord.” 22 Thus tongues are a sign not for believers but for unbelievers, while prophecy is a sign not for unbelievers but for believers. [1 Cor 14:21-22, ESV]
Now, Paul doesn't elaborate too much on what he actually meant by "sign to unbelievers", but fortunately we have the case of Acts 2 to venture an educated guess: Acts 2 was an extraordinary showcase of the gift of tongues as a sign for thousands of unbelievers, as the apostles were enabled by the Spirit to speak in languages completely unknown to them. Thus, if an unbeliever whose native language is X hears a believer (who doesn't know X) speak X, it shouldn't be hard to see that the unbeliever will be in shock in the face of such a miracle. The sign comes from the surprise factor: from the unbeliever's perspective there is no way how to explain that the unbeliever is speaking language X other than to accept that God is real and that He is revealing language X to the believer. (How is it that you are speaking my language !?!)
Tongues can be used to speak to oneself and to God (outside of church, probably in a private setting):
2 For one who speaks in a tongue speaks not to men but to God; for no one understands him, but he utters mysteries in the Spirit. [1 Cor 14:2, ESV]
27 If any speak in a tongue, let there be only two or at most three, and each in turn, and let someone interpret. 28 But if there is no one to interpret, let each of them keep silent in church and speak to himself and to God. [1 Cor 14:27-28, ESV]
Functions #1, #3 and #5 seem to overlap a lot and make more sense in a private setting. Functions #2 and #4 make sense in non-private settings, namely, in church and in front of foreign unbelievers, respectively.
Having clarified that, let's now look at what Paul said about himself:
18 I thank God that I speak in tongues more than all of you. 19 Nevertheless, in church I would rather speak five words with my mind in order to instruct others, than ten thousand words in a tongue. [1 Cor 14:18-19, ESV]
This means that Paul probably didn't make too much use of function #2 (tongues spoken in church), meaning that he probably devoted most of his tongue-speaking to functions #1, #3, #4 and #5, that is, for private self-edification, through prayer and worship, and as a sign for unbelievers (when he miraculously spoke in languages he shouldn't have known, leaving foreign unbelievers speechless, making them more receptive to the subsequent preaching of the gospel).
Responding to objections and questions in the comment section
Objection. I am not sure that your function #1 is an actual stated function of tongues - it may just be a statement of fact that if a person is speaking in a language unknown to all hearers, he is (obviously) only speaking to God and himself. The same is true of functions #3 and #5. Do not confuse a fact with an intended function. For example, when I saw a person working on a very old car using worn-out tires to hold the car weight on their sides, then I could have said, "Those tires are used to prop up the car" but that was clearly NOT their intended function - they were meant to go on the wheel hubs, not under the car body!
Answer. Function #1 (self-edification) comes from 1 Cor 14:4. If we look at the immediate context, we will notice that Paul is comparing the gift of tongues with the gift of prophecy:
Pursue love, and earnestly desire the spiritual gifts, especially that you may prophesy. 2 For one who speaks in a tongue speaks not to men but to God; for no one understands him, but he utters mysteries in the Spirit. 3 On the other hand, the one who prophesies speaks to people for their upbuilding and encouragement and consolation. 4 The one who speaks in a tongue builds up himself, but the one who prophesies builds up the church.
Paul is making a contrast: tongues edify the speaker, prophecies edify the hearers. To me, this sounds as a comparison of essential features, not just mere "statements of facts". If we see the self-edifying effect of speaking in tongues as a mere statement of fact but not as an intended feature, then we should also see the others-edifying effect of prophecies as a mere statement of fact but not as an intended feature. Otherwise, we would be falling into an exegetical double standard. (BTW, mandatory meme :-))
In the case of function #3 (1 Cor 14:13-15), Paul is not merely making "factual statements", he is actually encouraging the practice, using the first-person tense: What am I to do? I will pray with my spirit, but I will pray with my mind also; I will sing praise with my spirit, but I will sing with my mind also. He's not rejecting the practice or merely accepting its existence -- he is actually encouraging it, but with some caveats. Verses 16-19 provide more evidence:
16 Otherwise, if you give thanks with your spirit, how can anyone in the position of an outsider say “Amen” to your thanksgiving when he does not know what you are saying? 17 For you may be giving thanks well enough, but the other person is not being built up. 18 I thank God that I speak in tongues more than all of you. 19 Nevertheless, in church I would rather speak five words with my mind in order to instruct others, than ten thousand words in a tongue.
For you may be giving thanks well enough - this clearly validates the practice of giving thanks to God (i.e. worshipping God) in a tongue. Are you giving thanks to God in a tongue? No problem, that's great! BUT, if you are in church, surrounded by people, and if you don't receive the interpretation and share it, then those around you will not get any edification from your words. The key is in noticing this is only an issue if you are in a church setting. In private, it is not an issue!
Lastly, function #5 makes total sense in light of what we just said about functions #1 and #3. One speaks to oneself in the sense of self-edification (function #1) and to God in the form of prayer/worship/thanks-giving (function #3).
Objection. The main problem with your position (as I understand it) is its self-contradictory nature. When a person prays to God in a "tongue" or speaks in a "tongue", that language is either known or unknown to the speaker. If it is known, then the person can translate. If it is unknown, then clearly even the speaker is not edified!!
Answer. This objection relies on the assumption that the speaker himself cannot be edified if he doesn't understand what he himself is saying. I see two possible rebuttals to this assumption:
Exegetical rebuttal: Although the speaker would not get edified intellectually, he would still get edified spiritually:
13 Therefore, one who speaks in a tongue should pray that he may interpret. 14 For if I pray in a tongue, my spirit prays but my mind is unfruitful. 15 What am I to do? I will pray with my spirit, but I will pray with my mind also; I will sing praise with my spirit, but I will sing with my mind also. 16 Otherwise, if you give thanks with your spirit, how can anyone in the position of an outsider say “Amen” to your thanksgiving when he does not know what you are saying? [1 Cor 14:13-16, ESV]
If the person doesn't pray for interpretation, their mind will be unfruitful, but their spirit would still get the benefits. See How is speaking in tongues an edifying practice for individuals themselves?
Testimonial rebuttal (feel free to ignore it if you believe it's off-topic): There are tons of testimonies from people about their experiences of self-edification while praying in a language they didn't understand. And I'm not talking about gibberish (link, link, link).
Objection. Again, we clearly differ. Paul objects to a practice where the mind is unfruitful.
Answer. I agree that the optimal situation would be to have both your spirit and mind simultaneously edified, but from this it doesn't follow that only having one of them edified is equal to having no edification at all. If you only have your spirit edified, that's still edification nonetheless. Also, if the gift of tongues without interpretation were useless, then why would God give people the gift of tongues without interpretation in the first place? Because there is a valid use of the gift without knowing the interpretation :-) (Although knowing the interpretation would be even better, we agree on that.)