How does a transistor amplify current or voltage?

Of course, the conservation of energy always applies. Any increase in power/energy has to come from "somewhere else".

Yes, a relay is something like an amplifier. So is the gas pedal in your car... When you drive your car, the strength of your foot isn't moving the car. Power steering amplifies the force of your arms. Power brakes amplify the force of your foot.

On the other hand, a transformer is like a lever. A step-up transformer converts to higher voltage at lower current and a step-down transformer reduces the voltage and increases the current. The amount of energy-out is slightly less than the energy-in because transformers are less than 100% efficient. (Note that I'm talking about AC transformers, not DC power supplies which can sometimes be quite a bit less efficient.)