The serve is one of the most misunderstood techniques in table tennis. Many players serve just to get the ball in play, or to keep the opponent from attacking, or to try to score winners with every serve. So what is the purpose of the serve?
The primary purpose of the serve is to set up your attack. Unless the receiver does something to stop your attack, you should serve and attack essentially every time you serve. This doesn't mean your first attack has to be a winner, but it should be aggressive.
In the modern game, attacking usually means looping, either forehand or backhand. Most favor the usually more powerful forehand, but others loop from either side, depending on where the receive is, and some may favor the backhand loop. Others use the serve to set up their smash, either with a serve and smash, or a serve to set up a loop, and the loop to set up the smash. (This is rare at the higher levels, where looping completely dominates, but is still common at the intermediate level.)
This doesn't mean you don't sometimes serve for winners. In fact, players who do not have any "trick" serves that are designed to trick an opponent into an easy miss are lacking in their service game. (Trick serves usually only work a few times, however.) Most serves should be to set up the attack. Even if the serve is a trick serve where you hope the opponent will miss the serve outright, you should assume it's coming back, and be ready for the follow-up, which should be an attack unless the opponent does something to stop it. If anything, you should be so expecting your "trick" serves to come back that when an opponent misses it, you are surprised as you were so waiting to follow up with an attack.
Even defensive players should use the serve to set up an attack, even if it's an occasional one. For example, the defensive player may serve and look for a specific return (or just a generally weak one), and if he gets it, attack. If he doesn't, then he may go back on defense.
Some players may use the serve to set up their best rallying shot. For example, a blocker might serve long, and then quick-block the next ball. Or a counter-hitter might serve short topspin, which brings the receiver in over the table while starting a topspin rally, and then the server can get right into aggressive counter-hitting, with the receiver perhaps jammed to the table and so unable to start the rally off well.
Once you get into the mindset that the purpose of the serve is to set up your attack, then you can begin to gain experience on which serves set up which returns, and how and where to best to attack them. Once you have this serve and attack mind-set, you'll soon be dominating the points on your serve. We'll finish with an acronym that I just made up and that's a bit dated for the pre-looping years (when hitting dominated), but always remember to "Serve and Make A Strong Hit" - SMASH!