Formally defined, arbitrage is the simultaneous purchase and sale of equivalent assets to exploit price discrepancies In trading, and especially when talking about bots, it's often extended t
Formally defined, arbitrage is
the simultaneous purchase and sale of equivalent assets to exploit price discrepancies
In trading, and especially when talking about bots, it's often extended to "profiting from (market) inefficiencies". The nature of such trades implies that they are nearly risk-free.
For me, there are 3 types of arbitrage:
Price arbitrage (buy low, sell high)
System arbitrage (use a system's internal mechanism for profit)
Information arbitrage (know stuff before the majority does)
I will dive deeper into price arbitrage now, and focus on system arbitrage in the next article. Information arbitrage is an entirely different topic.
Simply said, price arbitrage is buying an asset low on one "exchange" and selling it at a higher price on a different "exchange" (exchange could also mean a different pair/route on the same exchange). In theory, you do it at exactly the same time, with a predefined price. Then it is risk-free. In reality, you often have execution delays or other timing topics, plus the risk of slippage (getting a worse price than expected).
Let's look at a few examples of how real-world price arbitrage can be done and the risks involved. Nearly all of them carry the risk of slippage, so I won't repeat that every time.
Long route

Benefits
Needs only the single order volume in funds.
Risks
Since you have to transfer the asset, you not only risk slippage from the execution itself, but the price will most likely move while transferring the asset.
Real world
You actually need to keep USD on both A and B, because you rarely know upfront which exchange will be the buy side. So you need more than one order volume in funds. Due to the usually "long" (in the world of arbitrage) waiting times for the transfer, this only works on niche assets with not-widely-used exchanges. As soon as the asset is big enough, there will be enough traders doing the parallel approach for this one to stop working.
Parallel approach
Keep a basket of assets (at least one) on exchange B and USD on exchange A
Buy on A and immediately sell the corresponding amount on B
Transfer USD and asset back to the original place when needed

Benefits
No timing issues with transfers.
Risks
You have to hold a stack of the asset, so you are exposed to market price movements the whole time.
Real world
Again, since you don't know which exchange will be the buy side, you keep USD and assets on both. Due to the asset exposure, you only do this on assets you want to hold medium term. There is not much point in making 30% a year from the arb if the underlying asset loses 50% or more. On liquid, major assets, rebalancing is rarely necessary because prices fluctuate enough that both exchanges constantly switch between buy and sell sides.
In-exchange loop
Keep USD on exchange A
There exists a full loop on exchange A across 3 pairs (e.g., ZECUSDT, ZECUSDC, USDCUSDT)
When profitable, trade USDT -> ZEC -> USDC -> USDT (or the other way around)

Benefits
No need for funds on another exchange. If done on a DEX, you can enforce via smart contract that the full loop is profitable or not executed at all.
Risks
On a CEX, you have slippage and price movement risks because execution is sequential, meaning the price on any of the 3 pairs might move midway. On a DEX, you have no price risk, but you still lose the gas fee if the transaction reverts.
Real world
This is the most effective arbitrage, which also makes it the most competitive. On CEXs, big players with top-tier VIP accounts (super low fees) dominate this. On DEXs, big players watch the mempool and compete with high fees to be first. Back in 2017, when Bitcoin exchanges were still relatively new, I was able to do this on Bitstamp with a JavaScript bot running directly in the browser (good old days). But bigger players quickly found the opportunities, and the easy times were gone.