When you attack, you automatically steal a maximum of 50% of the defender's resources. Of course, you must have cargo space to carry the resources or you will steal less. Fighting ships have little cargo space, so usually you would send cargo or megacargo ships along with the fighting ships. If the defender is a Bulfleet General subscriber and his espionage level is higher than yours, the game will send him a message warning him about your attack. Otherwise, a defender knows that an attack is coming only if he is online. The attack shows on the Overview page in red. You need fighting ships only if the defender has defenses or ships. If you attack planets that have no defenses and no ships, you can send cargoships only. Inactive planets will usually have no defenses and no ships, so you can try them first.
The second way is to pirate. To pirate, you must use field fighters only. A pirating mission will steal a maximum of 25% of the target's resources, and no warning will be sent to the target no matter what. I don't know if the defender can see an incoming pirating mission on the Overview screen. The good thing about pirating is that your field fighters will fight only against the defender's field fighters (if he has any) and will not fight against other ships or defenses. However, a single field fighter carries only 250 resources, so you need a lot of them to steal any worthwhile amount.
In my opinion, especially at the beginning, the most profitable system is to steal only from inactive planets. This way, you don't have to invest resources in fighting ships, and you can put all your resources to upgrade your mines and research. A good research is radar systems because the more fleets you can send out, the more resources you can collect.
Happy stealing!