how does the pill work?

So your placebo week is suppose to be your period week right? What happens if you have sex that week, are you still protected?
Also, how does the pill work? Do you still ovulate, if so then when?  Do you still release an egg?