There are countless responses to this question in the archives.
My own approach was to show up and ask anyone I saw what to do. I ended up paying 20-30 euros each direction on some sort of special sale deal. As I understand it, this was not intended to be applicable to myself and a bike, but such details don't seem to matter much. In one direction I paid at the ferry window; in the other, I bought from an agent (on which occasion I had to express my surprise and disappointment at the first fare offered before the agent offered the second, drastically lowered fare).
YMMV. Do check the archives for more comprehensive answers to your questions.