An Engineer is one of the available civilian units at the start of every game in Imperialism. He builds railroads (in a single turn) and depots, ports, and forts in three turns. He can work only in your nation, not in your colonies even if they desperately need forts.
After the discovery of High Pressure Steam Engine, which is generally noted as having been already purchased when a game starts (even at the hardest level), an engineer can do his work on most clear ground and forests. Swamps require the Iron Railroad Bridge (which also enables Foresters), costing $1,500 and available about 1824 in the standard game. Hills need to wait until the 1830s for the Compound Steam Engine (and are not available for ports), and mountains need dynamite, several decades away.
Unlike most civilians, an engineer needs to rest after moving, so you will not see the "work" icon (hammer) on a mouseover of any tile except maybe where he is. The work icon will appear, if applicable, when he wakes up next turn after a move. For building a port or fort where he is, or a section of railroad out from where he is, no rest is needed, and you can see the hammer icon where he is and the railroad icon on any available target tile.
He can build ports for $3,000, depots for $2,000, and railway sections for $100 upwards depending on the terrain. He can build level 1 forts for $5.000 at any time, and with the appropriate technology advances level 2 for $7,500 (needing Bessemer Converter, available in the late 1830s) and level 3 for $10,000.