Q:

How is movement calculated when running up walls as a monk?

Picture this circumstance.  I am a 5 foot tall level 9 Wood Elf Monk with Mobile.  I have 60 feet of speed per turn, via:

35 feet from Wood Elf feature
10 feet from the Mobile feat
15 feet from being a level 9 monk

And can run on walls via the monk's Unarmored Movement class feature.
I am 15 feet away from a medium sized melee combatant in a 5 foot wide corridor with a 20 foot high ceiling.
Avoiding all attacks of opportunity against me and without using any attacks from me and only the wall movement + speed listed, what is my maximum possible remaining movement to be on the other side of the combatant, out of range,  with this setup?  
To simplify this, I want to run up the wall, around the guy, without giving him a chance to hit me with his 5 foot range, and still have as much movement possible.  
You know, normal Monk things.

My main concern is how the movement starts, and how diagonals work while wall running.    Do I spend 5 feet to start "wall running" in the same square I'm in, or do I start by spending 5 feet to be 10 feet in the air?  Can I simultaneously move forward while moving up?
I've also considered the potential of dropping while on the wall to conserve movement (presumably 10 feet past the combatant), and I want to suggest that for anyone  to consider it themselves as a potential part of the answer.
Considering how abstract this question is, there may not be an official answer in 5e, but references to prior editions/Pathfinder on this topic would be valid substitutes.

A:

TL;DR: if you use PHB rules (diagonals are free), and end your turn at least 20' behind the NPC, running on walls is free.  It only costs the total horizontal distance.
If you use the DMG rules (every 2nd diagonal costs 10'), and end your turn at least 20', running on walls costs 10' of movement, plus your horizontal distance.

We can break this question into three parts:

How far up can an attacker reach?
How do diagonals work?
What is the minimum movement I have to expend to do this?

How far can an attacker reach?
PHB pg 146:

A melee weapon is used to attack a target within 5 feet of you

While plenty of medium creatures are greater than 5' tall, D&D abstracts a medium creature to be a 5'x5'x5' cube when dealing with grid spacing (it's the space they control, but their reach is measured from the outside of their controlled range).  
Given that, an NPC/PC can attack a creature which passes <5ft above their head, or <10ft above the ground.
So for you to get past the enemy without provoking an OA, you will need to pass 10ft above the ground they are standing on.
How do diagonals work?
RAW, diagonals are the same distance away as the adjacent squares (PHB pg 192).  This means that in 2 dimensions, you measure your movement in both dimensions, then pick the greater one.  However, there is an optional rule in the DMG (pg 252) that introduces a cost to them.  Namely, that every second diagonal costs 10', rather than 5'.
So, to sum up, Base rules says that diagonals are free, variant rules says that every second costs 10'.  We will continue with the base rules, because they're the base rules.
Moving through diagonal spaces
RAW, you cannot move through a diagonal if either of the spaces you would pass through to get there are blocked with an obstacle.  This could be a tree or a building.  Given this, it is clear that you pass through these squares, even if you do not count the movement this way.  This means that if you are attempting to avoid entering someone's threat range, you must not move diagonally around this range.
What is the minimum movement I have to expend to do this?
If we assume base rules, then your first move is to get 10' above your enemy.  But your enemy can reach the diagonal square above them, so you need to get 10' above the ground while you are still 10' away from them.  This will cost you 10'.
Now, you need to pass over their head.  Since they threaten squares 5' on each side of them, and you need to avoid having your diagonals pass through the threatened space, you need to move 20' along the wall.  This will cost you 20'.
Finally, you need to get to the ground.  Fortunately, you can fall for free, however, since you are falling 10', you will take 1d6 falling damage.  This can be avoided by taking a reaction to use the Monk's Slow Fall ability or by running down the wall.
If you run down the wall and intend to keep running, then this is essentially free, as you can move one space horizontally and vertically with the same movement.  If you want to stop within 20' of your attacker, then you will need to spend 10' of movement to get to the ground.
This will either cost you your reaction, 1d6 hit points, or 10' of movement if you want to stop within 20'.  If you wish to continue moving afterwords, this will not cost you any movement.
So, as long as you have at least 20' between you and your opponent, you can move above them without costing any additional movement
Diagram, from side view: (1 is start, 2 is end, N is NPC, X is threat range, - is path)
Continue running: 40' (horizontal distance, 40')  
  -----    
 - XXX -   
2  XNX  1

Stop Running: 30' + damage or reaction  
-----    
-XXX -    
2XNX  1

 
Bonus, what if the diagonals cost?
The path you travel is the same, but the cost is different.  Going 10' up and 10' over now costs 15' of movement.  The horizontal movement is the same 20', and the movement down costs 15'.
So for the variant rules, you will have to spend 35', and spend either your reaction (to fall using the monk's slow fall ability), take 1d6 hp (to fall), or spend an extra 15' to hit the ground 15' behind your enemy.
So if you are using the variant rules, provided you have 20' between you and your target, and want to end your turn 20' or more behind them, it will only cost you 10' more than the horizontal distance.  If you wish to stop right after them, it will cost 5' extra, plus your reaction, or 1d6 hp

A:

Here is how I would do it, step by step:

Diagonal step onto the wall and forward - 5 ft consumed
Up the wall - 5+5=10 ft consumed
Diagonal step up the wall and forward - 5+5+10=20 ft consumed
Forward on the wall - 5+5+10+5=25 ft consumed
Forward on the wall - 5+5+10+5+5=30 ft consumed

Now you are right above the enemy.

Forward on the wall - 5+5+10+5+5+5=35 ft consumed
Forward on the wall - 5+5+10+5+5+5+5=40 ft consumed
Down the wall to avoid 1d6 fall damage - 5+5+10+5+5+5+5+5=45 ft consumed

And now you can safely drop down with 15 ft remaining.
Here is a handy (I hope) visual guide.

