What is the difference between "gajni" and "venki"? Does it have anything to do with objects? I have a feeling there is a clear difference, but I think I mix them up and use them incorrectly a lot.
"gajni" comes from the English "to gain", and has more or less the same meaning as "to gain", i.e. it generally expresses the idea of receiving something. You can use it to translate "to win", especially in situations when you could replace "to win" by "to gain" in English. For example, you can say "gajni premion" for "to win a prize", as you can also say "to gain a prize".
When talking about winning a war, a battle or an election, one would usually use "venki" rather than "gajni". However, when used with a direct object, "venki" works like the verb "to defeat", i.e. the direct object is the person or army that was defeated. If you want to say "to win a war/battle/election", you should say "venki en milito/batalo/elekto". It is wrong to say "venki militon/batalon/elekton*".
There are also contexts where "venki" and "gajni" can be used more or less interchangeably. For example, "to win a sport contest" or "to win a lawsuit" can be either "venki en konkurso/proceso", "gajni en konkurso/proceso" or "gajni konkurson/proceson" (but not "venki konkurson/proceson"). If one is not actually receiving anything, the use of "gajni" in such context is somewhat metaphorical, but certainly acceptable.
"gajni ion" is to win something.
"venki iun" is to defeat someone.
Venki = To conquer or to become superior. You can win a game, war, competition, etc...
Gajni = To acquire something.
We conquered our enemies in the war, and gained freedom.
Ni venkis la malamikojn en la milito, kaj gajnis liberecon.