Short answer:
There isn't a run-function for all monads, and its use is evaluating data structures.
Medium answer:
Certain monads build data structures that will be evaluated afterwards. Let's say we want to build our own IO monad (I'll need to use GADT notation, basically I just talk about inhabitants and their specific types):
data SimpleIO a where
PutStr :: String -> SimpleIO ()
GetLine :: SimpleIO String
Bind :: SimpleIO a -> (a -> SimpleIO b) -> SimpleIO b
Return :: a -> SimpleIO a
Like this, we can build a few IO actions, like one that just reads a string and prints it: Bind GetLine PutStr
does exactly that.
However, our monad doesn't do anything: We don't know how to execute those actions, so we need some kind of conversion function:
runSimpleIO :: SimpleIO a -> IO a
runSimpleIO (PutStr x) = putStrLn x
runSimpleIO GetLine = getLine
runSimpleIO (Bind x f) = x >>= f
runSimpleIO (Return x) = return x
This is some kind of run function, it uses the monad-made structure to make use of it. It definitely isn't unique though: You might as well write a run function SimpleIO a -> Maybe a
. That's nothing defined within the monad, but more of an interpretation.