Why don't some bitcoin wallets give the private keys to its users? Is it safe to use these wallets? Is there any way for the users to know their private keys without the need to contact the wallets companies?
Electrum: pulldown menu "wallet", "Priv keys", --> export.
The idea to hide priv keys is linked to the security of the system. If the privkey is immedeatly "visible/accessible", the risk of unwanted access (be it malware, be it other people) is high, as the knowledge of the key allows for access to your funds. So the majority of wallets hide the priv key behind some access logic. There are passwords and seeds as most common layers, to be able to open the wallet, and then find the priv key behind a menu.
Yes, generally these wallets are save to use. On the opposite side there are so called "online wallets", offered by some providers. These wallets usually don't give you access to your priv key, and as such you have to trust these companies, that they have stored the priv key correctly (and safe) for you.