I would like to know the meaning of this: 'ah, That's the way it goes...'is it an idiomatic expression? I couldn't find it in the dictionary.
Not precisely an idiom-- more a 'fixed expression'. 'Go' here means 'follow a course, proceed', etc. The expression is a comment on the usual, natural or inevitable order of things:
A: I failed my entrance test.
B: Oh well, that's the way it goes-- just try again!
A: My girlfriend left me for a one-legged man.
B: That's the way it goes-- you can always find another girl friend.