How does pilot know when to trim when flying an aircraft that have fly by wire flight control computer
Fly-by-wire just means that the control column is not connected to the control surfaces (hydro-)mechanically, but using digital (electrical or optical) signal wires. That says nothing about how the controls behave. There are two basic ways they can:


The Boeing way:

Force and position is transmitted in both directions, emulating
control with mechanical link. The pilot feels force on the control surfaces and trims as usual.
The Airbus way:

The position of the control column corresponds to wing loading in pitch and roll rate in roll axis. The computer manipulates the controls to achieve the target values. The control column is spring-loaded, so force always corresponds to position.

The trim is operated by the computer to balance the control surface for wing loading of 1 G (or is not a separate control at all as in case of FBW fighters with all moving stabilator).

But when the system is in direct law (during take-off or if degraded due to fault), the trim still works more or less normally. The centred position of control stick corresponds to the trimmed position of the control surface, so if the pilot feels force on the control stick, because it is displaced, they dial trim and reduce pressure on the stick until the plane flies straight with the stick centred.


The Airbus way is used on Airbus A320 and all newer models, Sukhoi Su100 and some fighters (since F16).

The Boeing way is used on Boeing 777, 787 and, IIRC, some regional jets.