Typically, this is due to network issues rather than anything phone related. When someone sends you a text message and your phone is turned off, the message basically waits in a switch near where your phone was last seen on the network until your phone pops back up. Sometimes if you come back onto the network near a different switch or if there is a lot of network congestion (like on AT&T in a major urban center), the message will never get to you because the network resources are busy doing other things. In effect, it "forgets" about the message it has waiting for you.