Just as the title says. Is this a bug? Or do I have to wait a certain amount of time? Or am I supposed to do something?
If you are outbid, the money shows up in the "completed" tab, and you must send it to your stash. This transaction should be immediately after you are outbid.
If the money was not returned to you in the "completed" tab after you were outbid, then it may be due to AH lag currently affecting the servers (comment by WikWocket), or it was a bug and you should contact Blizzard about getting your gold back. Give it a few minutes, log in and out, and if it still doesn't show up, let an admin know.
The Auction House seems to be having a lot of problems right now, so be wary that it may be awhile before they have a response for you.
Your money is supposed to wait for you under the "completed" tab of the auction house. In my experience, it gets transferred there almost instantly after you are outbid, you don't need to wait - and you certainly don't need to wait for the auction to end.
To get the money back into your balance you need to select it in the "completed" tab and choose "send to stash".