How does it work

How exactly does a plan b work and what happens when it doesnt work or if I took it too late