To begin with, let me make clear that this topic is a complex one, and analysis is almost always subjective. To determine whether your attack has done enough damage, you will have to have set a goal for the attack, and know whether this goal was fulfilled. To simply attack and wonder afterwards whether you did "enough damage" is a waste of your time and resources.
Long story short: make sure your attacks have a strategical or economical objective, commit just the resources required to fulfil this goal, but no more, and get the hell out when this objective is complete. The military folks call this a "strategic attack".
Terminology
A push and harassment are not the same thing. Harassment is meant to create a small advantage you are going to exploit, or simply apply mental pressure on your opponent. A push, on the other hand, is meant to set back your opponent significantly. A well executed push will set him back so much that recovering is not feasible, consequently winning you the game.
More generally, the loss of a harass troop might set you back economically, but should not mean that your game is lost. Loosing your troops in a push, on the other hand, will often mean that you will lose shortly after to a counter attack.
The Push
Many players will only ever perform one big push in the entire game. This kind of player will sit on his bases, researching and defending, until his "Ball of Death" is complete. He then pushes out, and crosses his fingers that the ball succeeds in it's mission. If this push clashes on the rocks of their opponent's defence, the game is pretty much over.
One step up from this level is the initial aggressor. He will prod and pounce around your base before the 12 minute mark, at which point your defences should have pushed him back home, and he will then sit there and do the same as above.
Harassing
A defending, passive player will mostly leave you alone, bar the eventual scouting poach. But no matter how good his defence, you can always chip away at him, slowly but surely setting you ahead. This is called "harassment" or "pressure". But this pressure needs to follow a plan, or it will just be lost resources to you.
Economy
Any kind of attack entails an economic investment. You have to weigh up this investment with the damage you expect to cause. The more you invest in your attack, the more damage you have to cause to "break even". Ideally, though, you will want to cause more economical damage than the sum total of your investment.
By applying good harassment, you can try to keep up with an expanding player without expanding yourself, although this is only ever very temporary. The only situation where you would not expand is in a so called "one-base all-in", which relies heavily on timing. If your timing gets delayed for some reason, you may delay your opponent's economical rise by applying selective pressure, forcing him to build defensive structures and units instead of committing to tech and economy. Killing workers, or even entire expansions, is an excellent way to achieve this.
When speaking of economy, Starcraft 2 is a spreadsheet. Whoever collects more resources faster, and is able to invest them better, wins. If you are behind, you hit your opponent in his metaphorical wallet to even the game. If you're ahead, you hit him right there, to get further ahead. Of course "being ahead" is always subject to the relative level of skill between you and your opponent. This kind of speculation always assumes equal skill, which is never the case in practice.
Strategy
Economical advantage is all good and nice, but a strategical advantage can lead to a much faster victory. Generally, you will want to try and deny your opponent a tech path that is strong against your intended build. For example, if you're a Terran going for an army composed mainly of tanks, you will want to minimize the amount of Immortals your Protoss opponent has by delaying his Robotics tech as much as you can, and picking off individual Immortals before the grand engagement. You know that Immortals are expensive and slow to build, so denying him expansions is an effective way to limit his production rate, and continuous pressure will force him to commit resources to other units in order to stay alive.
Almost as important as the mathematical factor to pressure is the mental factor. By executing a lot of hit-and-run attacks, your opponent will often get nervous, and his attention will divert in the moment of the attack, allowing for flanking attacks, or picking off strategic infrastructure easier with a drop.
Executing a big drop in the back of his base will often force your opponent to pull a large chunk, or even all, of his army back to defend, which leaves the proverbial door wide open to a frontal attack. The sort of multi-tasking required to effectively defend from this kind of two-pronged attack is usually only found in the very highest level of players, but the ability to execute such an attack with minimal losses is equally hard. In a pinch, you can simply suicide your drop and commit to the frontal attack, hoping to catch his army in a weird position once the drop is cleared.
A good player will have his army constantly moving around, so you don't know where it is, and making it hard for you to flank it. Catching a big army out of position, like tanks unsieged, or vulnerable units in the wrong spot relative to other, harder units, is key when your army is smaller or your unit composition subobtimal. To flank his army, you will need to know where it is, and where it's going. This means that you either have superb scouting, or you and foresee his movement. A strategic drop in his base can make him pull a good chunk of his army back, which makes his movements predictable, and thus, vulnerable.