If the router has a spare LAN Ethernet port (many do) you can connect an ethernet cable between the router and an Arduino Ethernet Shield on your Mega 2560. Then use DHCP as in the various Ethernet examples to have the router assign a local IP address to the Arduino.
If the router does not have a spare LAN Ethernet port, or the router is too fare away to easily run a wire, connect an Arduino WiFi Shield to your Mega 2560. Then use DHCP as in the various WiFi examples to have the router assign a local IP address to the Arduino.
In either case you will need to configure a port forwarding on your router if you want to access the Arduino fro the outside world. If you only want the Arduino to access your LAN and the outside world you don't need port forwarding.