In the end it's all a big lottery
It's not a lottery. It's not close to a lottery. It's ridiculously, absurdly far from being a lottery.
Do agents pick manuscripts
at random from their slush piles and decide to represent them?
Do publishers pick manuscripts
at random from their slush piles and decide to represent them?
No? Then it's not a lottery.
The study of statistics takes terrible abuse in threads like this. Say this is a fact:
2% of manuscripts get published
I don't know whether it's true, and I'm not aware of any reliable way of finding out, but let's say it's true.
Here's another fact:
I have written a manuscript
which is true, as it happens.
This
therefore my chance of getting published is 2%
is an inference. One that is only true if manuscripts are chosen for publication at random. Otherwise, I'm unable to estimate what my possibility of publication actually is. It's unknowable.
For most MSs, the probability of publication is actually effectively zero, because their quality is so low no publisher will consider them. A few MSs will be so good they're highly likely to be published. There's probably some that could get picked up on a good day but won't on a bad day, but there probably aren't many of these at all.
All you can do is keep improving your writing, and hope feedback from beta readers, writers and agent provides a reasonable estimate of your progress.