There are two key functions that keeper bots serve:
They monitor the price of all assets available on the perpetual protocol. If the price of these assets change such that a users advanced order can be executed, they call the execute() function in order for that order to be fulfilled.
They monitor price changes for all trailing orders, and update the trailing order parameters accordingly.
Both of these actions are financially incentivised by the smart contracts.
A user that is able to run a script that can perform these tasks will be paid by the protocol.
As the number of orders on apex increases, the total sum of fees to bots will increase. It can therefore be profitable to run an effective bot.