M.B.
If you consider these two things "failures", you really will have problems later when you have teens ;) Anyways, I don't consider either to be big mistakes - it sounds like you've done a great job overall and there's not a parent in the world that has a perfect child. And, these behaviors are quite normal and not at all unusual for kids this age and don't reflect poor parenting.
As far as #1, part of that habit is learned, but it is also totally natural for kids to need their parents more sometimes than others. And, kids that are more active (and intelligent) often seem to have more difficulty with easily settling in for the nite. YOu also might consider looking at what happens during the day on the nites where she doesn't settle in well - maybe too much activity or perhaps not enough outside time or not enough one on one time with mom. I also don't think that spanking is effective at all in this situation. Both my sons needed extra time with us at nite and I found that staying in their room for a bit while their nitetime story tape was playing helped everyone calm down. Also, on days that were busier, I really tried to make sure that we started our winding down earlier - that may sound the reverse of what you need but an overtired child can have more difficulty falling to sleep than a child that isn't. Also, you don't mention how much she sleeps - part of this may have to do with her needing less sleep and some kids do give up naps pretty early - my older son never napped at home after he was two. This seems also to have become a power struggle, so it might really help to change your tactics and rather than take away privileges perhaps give her something extra the next nite - i.e, an extra bedtime story IF she goes to sleep well the nite before.
2) It's not totally realistic to expect a two year old to sit through a meal while parents try to enjoy their meal, so you might really want to consider not eating out as often for a while and as someone else suggested talk to her to set expectations beforehand. And, I used to think that other folks had issues "teaching" their kids "properly" when they were doing what your daughter does in restaurants - that was until I had my 2nd son who was crawling out of his high chair at about a year (undoing the buckle) and could not stay in his seat for an entire meal even at home.