To better understand expressions like “zwanzig vor” and “fünf vor halb fünf” it may help to imagine the clock as depicted below:

"Vor" and "Nach"
Generally, if something is within 20-25 minutes before the hour, Germans use “vor”, and for everything within 20-25 minutes past the hour, they use “nach”:
Es ist 10 vor 6. It’s 10 minutes to 6. = 5:50
Es ist viertel nach 6. It’s quarter past 6. = 6:15
Es ist 20 nach 6. It’s 20 past 6. = 6:20
Es ist 10 vor. It’s 10 minutes to the hour. = X:50
"Halb"
If something is within 5 minutes of the absolute bottom of the hour (where the 6 is on a clock), this is called “halb” and Germans use expressions like “vor halb” and “nach halb”.
Note that halb refers to half of the hour you’re in, so 5:30 would be “halb 6”.
Es ist 5 nach halb 6. It’s 5:35.
Es ist 5 vor halb 6. It’s 5:25.
Es ist 5 vor halb. It’s 25 minutes past the hour.
Kurz
If you’re talking about just a few minutes, Germans often use “kurz vor” or “kurz nach” rather than be specific. Not, however, at train stations, or anywhere you might use the 24-hour clock. This quick lesson is great to learn German for beginners, as telling time is something you will use daily!