Either from itself or from its immediate peers.
If you create a new tx on your client (a bitcoin node) your node now "knows" something the rest of the network doesn't so it verifies it, store it locally (memory pool of unconfirmed txs), and relays it to its immediate peers (the other nodes you are directly connected to). Likewise when those peers receive your new tx they "know" something the rest of the network doesn't. So they verify it, store it, and relay it to their peers. Those peers verify it, store it, and relay it to their peers until eventually every node on the network is aware of this new tx.
Now I used a tx as an example but the same is true of any information. If your node is new and joins the network the fact that it exists is new information so it will relay it to its peers. If you are a miner and solve a block the knowledge of that block is new information so you will relay it to your peers. Those peers will verify the block, store it locally, and relay it to their peers. The same thing applies to any information about the network, transactions, known peers, blocks, alert messages, etc.
The key thing to take away from all that is the network is at the simplest level a information relaying network. Nodes verify information first (just because another node sends you a tx doesn't mean your node trusts it), stores it locally, and then relays it to its peers.
How the mining software knows that it has created the winning hash? As far I know the mining software looks for the correct hash, but when the software knows that the last hash created is the correct/incorrect one?
The mining software is told either by the node directly or by the pool server (which acts as a type of proxy). The network has a target which is just a 256 bit number it varies inversely with difficulty (difficulty goes up, target gets smaller). All nodes know the current difficulty because they compute it every 2016 blocks based on how long the last 2016 blocks took.
The current target in hex is: 0x0000000000000000896C00000000000000000000000000000000000000000000
http://blockexplorer.com/q/hextarget
If the hash produced is smaller than the current target it "wins" and the block produced is valid (and relayed to the rest of the network).
If the hash produced is larger than the current target is "loses" and the block produced is invalid (and discarded).
It really is that simple. Each hash is simply a random (very small) chance of solving a block. You keep trying modifying the blockheader until you find a "winner".
To make it more obvious I am going to shorten the target so we just look at the first 20 hex digits: 0x000000000000000A896C
So say you hash a blockheader and the leading 20 digits are:
0xF128547630A12032896C = loser
0x30A12032F16896C28547 = loser
0x00008547630A2032896C = getting closer but still a loser
0x0000000000000032896C = oh so close but still 100% a loser
0x000000000000000003FF = winner
The last one is a winner simply because it is smaller than the target.
0x000000000000000003FF is less than
0x0000000000000000896C
or if you prefer full length
0x000000000000000003FFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
0x0000000000000000896C00000000000000000000000000000000000000000000
Any value for hex is still less than the target much like 1xx is always less than 200.