Ok, assuming the pedal isn't broken, this should be really easy to do, but very tricky to explain, so I'll try it with pictures lol.
First, have a look at the areas I've highlighted in green and in red on your original pic starting with red:
The bit I've highlighted in red is a T shaped trench. The base part of the pedal has a T shaped bottom to it and it's that that fits snuggly inside the T shaped trench. It's very snug, so the only way you can re-seat the pedal would be to slide it in from the side. Have a look at my picture below and I've drawn it to explain also circled in red. If the pedal bit that has broken off does not have this T shaped bit at the bottom, then the pedal is stuffed.
The bits I've highlighted in green simply pushes together. The base part of the pedal fixed to the car has a solid cylinder shaped piece of plastic which you can just see on your pic circled in green on the right. The part of the pedal that has come off should have a cylinder shaped clip that will snap down over it and holding it place which will be where I've circled in green on the left.
Imagine that it's like a little lego dudes hand and you are snapping something into it. Again, if this is broken, the pedal is ******.
I've probably explained this pretty crap, but if you look at the pedal it should become clear.
Failing that, I have a replacement for sale very cheap in the classifieds if you need a replacement.
Advert is here:
Audi A3 Pedals
I hope this helps