Most of the discussion around this is whether or not a president can pardon themselves. I believe the outcome will be that they can, but there's a lot of discussion amongst academics either way.Yeah I could see him resigning if he lost, and Pence giving him a blanket pardon like Ford/Nixon. There will be a legal challenge on this if Pence is implicated in any of the crimes too, which he is.
The simple answer will be that Trump pardons Pence, resigns and then Pence pardons Trump.