In the main battle menu (fight, switch, item, run) the run button is greyed out in trainer battles. But if you go to the Switch Pokemon menu (including when one of your pokemon is knocked out) the Run button there is clickable, and presents you with a dialog to see if you really want to forfeit the match. However, clicking yes doesn't do anything and you must battle on regardless.
Aside: I think that forfeiting trainer battles should be allowed, and I made a post in the feature requests forum for that. But either way, this interface thing should be made consistent with whatever decision is made.