USSD Gateway. Unstructured Supplementary Service Data, or USSD is a communication protocol used by GSM cellular telephones to communicate with the service provider's computers. A gateway is the collection of hardware and software required to interconnect two or more disparate networks, including performing protocol conversion.

Functionality
A USSD gateway routes USSD messages from the signalling network to a service application and back. A 'USSD gateway' service is also called a 'USSD center'.  

USSD gateway is based upon the ability of the delivery agent or the source to send and receive USSD messages. A USSD is a session-based protocol. USSD messages travel over GSM signalling channels, and are used to query information and trigger services. Unlike similar services (SMS and MMS), which are store and forward based, USSD establishes a real time session between mobile handset and application handling the service.

Difference between USSD and other gateways
The difference between USSD gateways and other messaging gateways is that USSD gateways maintain a single interactive session once the connection is established. SMS and MMS store and forward messages independently of the user session, similar to the way email is sent over the internet.

Modular operation
Session module: as per directions from the Signalling System No. 7 (SS7) protocol stack's Mobile Application Part (MAP), it receives and sends out session IDs from the session ID pool, and maintains and destroys the sessions.
MAP layer: Mobile Application Part is present both on the server and on the MS. 
Gateway: a gateway will wait for messages from the MAP layer, and work to route these messages into Short Message Peer-to-Peer (SMPP) protocol, which is then delivered to the server applications. This is the most important operation, and this is the reason why USSDs are primarily used, as it helps to directly connect users to applications like bill checking and others.
Locator: this tries to find out the current cell site, and relays it to the gateway. Then the messages are routed using Routing Numbers.
Home Location Register: this is the home zone where the given cell phone's number is registered in the database. This is different from the Visitor Location Register which is where the user is roaming.
The reason why USSD is commonly used is because it enhances the WCDMA signalling and multiplexes the coherent signals.

Types of applications
Balance Check: the user can send a Process Supplementary Service request (PSSR) to the home zone, which will forward this, under guidance from the gateway, to the correct application. Then, the application sends an acknowledgement via USSD gateway, HLR etc., known as PSSR response back to the user. Balance Notification at the end of charged call can also be given using Unstructured Supplementary Service Notify (USSN) message.
Voice Chat: using the same process as above, one can use voice chat. This is highly useful when VoIP enabled phones are not available.
Advertising: the application can advertise their product using USSD, which is less invasive than telemarketing.
Roaming: this has huge advantages while roaming. This is because USSD services are well available in roaming networks, and all the USSD messages are directed towards the subscriber's Home Network itself, thus, same set of services that are available in home network can be given in visited network too, giving subscribers a Virtual Home Environment (VHE).

Apart from PSSR and USSN, there is another method called Unstructured Supplementary Service Request (USSR) message that initiates a session by USSD Gateway to a Mobile User. This message can be used in conjunction with USSR initiated session to provide session based services like Menu services through USSD. Also, in the earlier phases of MAP (Mobile Application Part), PSSR message was called PSSD (PSS Data).

References

Further reading

Mobile telecommunications standards
3GPP standards
GSM standard