Your starting gravity is key to determine your mash efficiency. Here is how it works. Grains are rated for maximum gravity points. Here is a link to a chart that will tell you the gravity points for a specific grain.
https://www.homebrewtalk.com/wiki/index.php/Malts_Chart
Most malt extracts will vary and you can check the manufacturers website to determine how many gravity points you get from the extract. Also if you use Beersmith they give you the gravity points for everything. Here is how you would calculate your mash efficiency.
Let's say your recipe calls for the following fermentables:
Pale 2 row malt - 3 lbs
Crystal 60 - 1 lb
Vienna - 1 lb
2 row Pale malt has 36 gravity points x 3 lbs, its potential gravity at 100% conversion would be 36x3=108 gravity points.
Crystal 60 malt has 34 gravity points x 1lb, its potential gravity at 100% conversion would be 34x1=34 gravity points.
Vienna has 36 gravity points x 1lb would be 36 gravity points.
Add up all of the potential gravity points:
Pale malt - 108
Crystal 60 - 34
Vienna - 36
Total - 178
So your potential gravity if you convert 100% of the grains would be 178 gravity points. (I don't think it's possible to get 100% but I have heard of people getting 90%)
Once your mash is done and you have collected all of the wort from the mash, you will have to take a gravity sample. You will need to cool the sample down below 90 degrees and then you can take your gravity reading. You will then need to adjust the gravity reading for temperature. Here is a link to a calculator that will adjust your reading for temperature.
http://www.brewersfriend.com/hydrometer-temp/
Now you can determine what your mash efficiency is. Let's say for example that your gravity reading was 1.047 and you collected 2.5 gallons of wort. To determine your total gravity you would multiply your gravity points of 47 x the number of gallons of wort collected. So 47x2.5=117.50.
Now divide the gravity points of your wort, 117.50 into the potential gravity points which is 178. 117.5 divided by 178 = 66% So your mash efficiency is 66%.
From here you can determine how much dme or lme you may need to add to get to the desired specific gravity.
I also recommend getting some sort of brewing software like Beersmith. It makes it very easy to design recipes and determine what your efficiency is. Beersmith was the best $25 I have spent on brewing.
Hope this helps.