I've been exploring the tangle, but I can't seem to find out why some transactions are confirmed while others are not.
It depends on the topology of the network and the tangle. If your node is at the "edge" of the network, your transaction might be slow to propagate through the whole of it, and the majority of other nodes will see younger tips before they see yours. Also consider the following points:
If the tangle is very wide (having a large number of tips), and suddenly the global transactions per second drop a lot, many transactions will stay unconfirmed for longer, because fewer new transactions have to confirm a large number of tips.
If you attach your transaction to a "lazy tip", it's likely to not
get confirmed, because others will choose tips will lower depth.
Afaik default depth is 3-12 in the wallet.
If you attach your transaction to a subtangle that contains a
doublespend, your transaction will be ignored, because confirming it would render the tangle in a conflicting state.