Is it OK to ask a professor if they have a postdoc position available? I am a PhD student working in applied probability theory. I have submitted my PhD thesis and started to apply for postdoc positions.

Is it OK to ask a professor whether they have a position available? If so, what should such an e-mail contain?
Yes, it is fine. It never hurts to ask. Some people will ignore you, but some people will reply.