Welcome to this guide that will help you make safe and fair lottery machines on our server. I will not tell you how to make a machine, I will guide you on how your machine can be fair or NOT fair, you can build your machine however you like, as long as it follows our guide here.
Rules:

You MUST mention the starting chance of winning your lottery.

If you advertise fixed chances, your lotto must be closed once any of the slots are emptied (changing the actual chance).
If you have increasing chances and you stack your losses, your winnings must be stacked by the same amount. 
You must explain how your machines work, so the user can be aware of how your system work.

Mystery prizes are not allowed, you MUST mention whatâ€™s the prize inside.

If your winning prize is money, make sure it is a signed book, nothing else, we will NOT refund you if someone took your renamed item, duplicated it, and stole all your money.

Test your machines before making them available, if your system failed a lot, it will look like a scam and get you in trouble.
Examples and explanations for each rule:

Make sure to mention the starting chance of your lottery. If you have 8 trash and 1 winning item, your starting chance will be 1/9, 1 refers to the number of winning items, 9 is the number of trash + winnings.
For example:
This is exactly 1/9 as starting chance, the prize is the sword and the trash is the fish.
8 trash, 1 winning, total 9 items.
You can do a higher winning chance by lowering trash items.
This is a 1/5 chance to win.
You can also higher the chance of winning by increasing winning items:
Here, the chance is 4/9 because 4 items to win, and 9 items (prizes + trash). 
If your machine has a fixed chance, your lotto must be closed once any of the slots are emptied (changing the actual chance). This can be done by installing an indicator or iron door which closes automatically, avoid doing this by hand.
If your machine has an increasing chance, your prize stacks must be the same amount as the losing stacks.
Here is an example of UNFAIR stacking:
There is only 1 prize and 64 x 8 stacks of trash, this is a SCAM and will get you banned.
An example of a FAIR stacking:
The prize stack is the same amount of losses stack, this is a 1/9 starting chance. 
You need to describe how your system works exactly, mention the chance, how many prizes and trash items there are.
For example, explain that if someone already won the lottery, you have 0 chance to win in the case of 1 prize and 8 trash, if someone won the prize at some point, there will always be losses, explain it and save us and yourself from headaches. 
You can not say that 1/9 chance to win a mystery item, however, you can say the chances to win a level 30 Enchanted Book. The items in the lottery are known, but the drop will be random, as long as it is a level 30 Enchanted Book as you said, it is fair.
It is unfair when you put a mystery prize, for example, a fish, and ask for money for it, even if it is a God Mending Sword, YOU MUST MENTION THE ITEM. 
Here is an example of how you make money prizes:
It is original, not a copy, not a copy of a copy, this item can NOT be duplicated by other players.
Here is an example of a stupid money prize item:
This can be duplicated by other players, even if it was renamed multiple times, players can use mods to find how you did it, and duplicate it to bankrupt you, we will NOT refund anything if you have done this. Donâ€™t be a low IQ person. 
Make sure to test your machines and make sure they are working correctly, however you build it doesnâ€™t matter, as long as it works, doesnâ€™t break, and is following this guide, you will be fine.