As you have already realized, the tiles that are given to you at the beginning of each hand are given strictly by chance. What you make of those tiles are strictly up to you though, and with more skill and knowledge of how to play the game, you will learn to use strategy to get the tiles that you need to get the biggest score possible.
Each time an opponent discards their tile, you learn the location of just one more tile that you may need or want. The same thing happens each time you pick a tile and discard one. The tiles that have been melded on the table are obviously known tiles, which can be helpful to figure out which ones you may need later on. Since the discards are only visible for one turn on the table, it may be hard to remember them, but it is vitally important that you do.
You should make every effort to keep track of all the tiles that are discarded, whether or not they are picked up. If they are picked up then you will see them later in the melds, making it a bit easier, but if it is not picked up you need to use your memory to remember it. There is not way to teach someone how to perfect their memory. Some are just lucky and have photographic memories, but most people do not. The only thing that will help you is to practice your memorization techniques. A good way to do that is to visualize the entire deck of tiles in a specific pattern of colors and numbers and then subtract from the pattern all the tiles that are dead. For this game, this is only the discard tiles that are not used and then become covered by the next discard.
When the discard tiles are picked up you should constantly review those particular tiles. Once a tile has been melded on the table, it is important to discard it from your memory so that you are not playing defensively against it, or looking for it to come up. It is also important to forget the tiles that you have been remembering from a previous hand that could really throw off the hand you are in now. This can be extremely important in increasing the odds of getting the tiles you need because you certainly don’t want to be looking for a tile you do not need.
The other two ways of increasing the possibilities of forming melds that you need are to pick from the drawing pile as well as the discard pile, and to use the open melds on the table. Unless someone goes out, you have a minimum of 39 picks from the drawing pile if there are two people playing, 21 picks if three people are playing, and 12 picks if four people are playing. Since the discards are seen by everyone, they all know the tiles. However if you are picking from the draw pile then only you will know the tiles, giving you an advantage of getting exactly the tiles that you need to win the game.