Usage differs between different parts of the English-speaking world. In North America, a streetcar runs on rails in city streets, often in mixed traffic, sometimes on its own right-of-way. It may also be called a trolley, or trolley car, although this usage is disappearing. Recently installed systems are usually called Light Rail. In Britain and Australia the same things are called trams traditionally. In Brazil these are called, insofar as they exist, as bonde. I was on the Santa Teresa bonde when I visited Rio about 5 years ago - when I went again, this last September, the rails are still there, but the wires are gone and no vehicles can be seen. In Portugal, trams are called eléctricos (equivalent to what they are called in my native Hungarian, villamos).
Trolleybuses, sometimes called trackless trolleys in North America, run on rubber tires (tyres in Britain) and receive electric power from a pair of overhead wires. They do not run on rails. I don't think they are ever called just plain trolleys in the English-speaking world, but I could be mistaken. Vancouver BC, where I live, has the last remaining trolleybus system in Canada. São Paulo has trolleybuses in Brazil, maybe other cities have them as well (Santos?). As a side comment, a few years ago I was on what may be the only remaining trolleybus system running on the left, in Wellington, New Zealand.