Most people are using brewing software to do the calculations. There are free ones, but the most popular is beersmith.
If you want to do it by hand, your efficiency is just the amount of sugar you got divided by the maximum amount of sugar in the grain.
eg 5 gallons of 1.045 wort has 5*45 = 225 sugar points. If your grain started with the potential for 350 points, you would have 225/350 = 64% efficiency.
Each grain has a rating for how much sugar is available listed as percentage compared to simple sugar. Base grains are around 80%. Specialty grains vary. To get the sugar available, you multiply that % by 45 and the lbs you used. eg 12 lbs of a 80% dry basis malt would be 80%*45*12 = 432. Do that for each malt and add them all up to get the total for your grain bill.
Example:
10lbs 2-row @ 81% + 1lb crystal 60 @ 75% = 10*45*.81 + 1*45*.75 = 364 + 34 = 398
if you got 5 gallons of 1.060 wort, the sugar you got would be 60*5 = 300
Your efficiency would be 300/398 = 75%