You clearly need to get wise to busses - I2c and SPI, and also what you are holding in your hand.. If you were already, you would not be asking these questions.
Not in order, the SD card is an SPI device and you have already demonstrated it works and you are doing the right thing.
If HC-SR04 is also an SPI device, it may share with SD, but requires it's own CS pin, not pin 4.
The RTC is an I2C device and goes on the I2C bus, pins A4,A5, and it may share with other I2C devices.
Pins A0>A3 may be used as digital or analogue.
Incoherent
IF the ST7735 is an SPI device, it may share the bus with SD. If not SPI you should be able to put it on "non-bus" pins, like 2,3,5,6,7,8,9
IF the BME280 is an I2C device, it can share with RTC.
I'm not sure you really have a problem, but you need to know which pins the motor shield actually uses. The SPI and I2C pins are most probably just pass-through.
Sorry,
But I didn't add the ST7735 yet. Today I read something about it and I thought maybe it makes a problem for the Arduino board if I try to connect several components to the same digital pins. So, I asked this question.
Thanks a lot for your time and your reply, It was very helpful for me.
I doubt the the SD card worked with the HC-SR04 on pins 11/12 as this conflicts with the shared hardware SPI pins 11/12/13.
The ST7735 uses hardware SPI so your pin selection is fine but the HC-SR04 cannot remain on pins 11/12, it needs its own dedicated digital pins. You also need a PWM pin for the L298. The possibles that remain are pins 3, 5 and 6.
Pin 10 SS is the secret here for SPI.
If you have multiple SPI devices, each one needs its own SS (Select) pin.
You also need to specify those different pins in your libraries or code.
I2C devices have unique addresses- scan the bus to find them, then use those addresses in your code.
Worst case you could need an I2C multiplexer (unlikely).
Just to give some more details on what @WattsThat said. The reason why the HC-SR04 can't share pins 11 and 12 is because it's not an SPI device. You can share the SPI bus between multiple SPI devices. But if you're using pins 11, 12, 13 for SPI communication, you can't have any non-SPI devices connected to those pins.